我有以下代码:
基本上就是从每个文件中提取md5。问题是有空格的文件,程序的解决方案可以考虑到这些文件,而不是跳过它们。在
def onepath(archivo):
logging.basicConfig(filename=salida,filemode="w", format='%(message)s', level=logging.DEBUG)
for filename in (file for file in os.listdir(archivo)):
with open(filename) as checkfile:
logging.info("MD5 " + "(%s) = " % filename + hashlib.md5(checkfile.read()).hexdigest())
我在读shlex方法,但不确定如何实现。在
你能帮我吗?在
我认为有空格的文件正在显示。我做了一个简短的片段,我面对的问题是我无法控制Linux如何理解文件名上的空格,以便做到以下几点:
在shell中显示:
bash-3.2$ ./comodin.py ./espacio/
Boxx view.pdf
cp: Boxx view.pdf: No such file or directory
hola.txt
hola.txt -> /tmp/hola.txt
bash-3.2$
相关问题 更多 >
编程相关推荐