bobbai 发表于 2017-4-25 10:37:37

python的文件操作

import os
import sys
class LineCount:
def getTime():
return sys.version
def listAllFiles(name):
if name=="":
return "file name can not be empty"
else:
count=0;
dirs=os.listdir(name)
for dir in dirs:
fullPath=name+'\\'+dir
if os.path.isdir(fullPath):
LineCount.listAllFiles(fullPath)
else:
count=count+1
#print(fullPath)
return count
#use class
print(LineCount.getTime())
fileName=input("input the file folder name:")
print(LineCount.listAllFiles(fileName))
页: [1]
查看完整版本: python的文件操作