如下面的代码段,是遍历/var/log的代码,可以根据这个代码进行修改~
import os
from os.path import join
for root,dir,files in os.walk('/var/log'):
# print(root)
# print(dir)
# print(files)
for name in files:
print(join(root,name))
如下面的代码段,是遍历/var/log的代码,可以根据这个代码进行修改~
import os
from os.path import join
for root,dir,files in os.walk('/var/log'):
# print(root)
# print(dir)
# print(files)
for name in files:
print(join(root,name))