37,721
社区成员
发帖
与我相关
我的任务
分享
#!/usr/bin/python
import os,re,linecache
def walkFilesInPath(path, extfilter='.xml'):
for root, dirs, files in os.walk(path):
for filename in files:
if os.path.splitext(filename)[1] == extfilter:
yield os.path.join(root, filename)
def processFile(filename):
newsp = (linecache.getline(filename,4)).rstrip().split('.')
print(newsp)
def fun(path):
for filename in walkFilesInPath(path, extfilter='.xml'):
processFile(filename)
fun(r'C:\wmpub')
这样子输出了啥?