我的档案目录如下:
_1 blank file_
_10 - blank file_
_11 - blank file_
_2 blank file_
_3 blank file_
我愿用添加的号码(2个特性)来印出名字。
我有:
PATH = "/Users/seth/python/test"
#
#
for (path, dirs, files) in os.walk(PATH):
for z in files:
filename = z.replace(" ","_").replace("-","").replace("__","_")
print filename
<<>Desired Output:
_01_blank_file_
_02_blank_file_
_03_blank_file_
_10_blank_file_
-11_blank_file_