课后习题中遇到的问题
import easygui as gimport os
Code_base = g.diropenbox(default='D:\\py文件')
os.chdir(Code_base)
file_type = ['.py']
code_dict = {}
def Search_file(path):
for each_file in os.listdir(path):
if os.path.splitext(each_file) == '.py':
with open(each_file,'rb') as code_file:
code_dict = 0
for i in code_file:
code_dict += 1
if os.path.isdir(each_file):
Search_file(each_file)
os.chdir(os.pardir)
g.msgbox(code_dict)
Search_file(Code_base)
显示框你鼠标滚轮滚动一下,没显示全
页:
[1]