import os,sys
for root,dirs,files in os.walk(sys.argv[1]):
for name in files:
print(os.path.join(root,name))
for name in dirs:
print(os.path.join(root,name))
要写sys.argv[1],
python filename 参数
这里的参数是个路径
import os,sys
for root,dirs,files in os.walk(sys.argv[1]):
for name in files:
print(os.path.join(root,name))
for name in dirs:
print(os.path.join(root,name))
要写sys.argv[1],
python filename 参数
这里的参数是个路径
转载于:https://www.cnblogs.com/baxianhua/p/10097835.html