根据报错提示,是你没有安装几个运行包
请在cmd窗口内输入
pip install turtle
pip install tkinter
如果能帮到您,请采纳,谢谢!
python读取文件大小的代码如下:[python] view plaincopyimport os
from os.path import join, getsize
def getdirsize(dir):
size = 0L
for root, dirs, files in os.walk(dir):
size += sum([getsize(join(root, name)) for name in files])
return size
if '__name__' == '__main__':
filesize = getdirsize(r'c:\windows')
print 'There are %.3f' % (size/1024/1024), 'Mbytes in c:\\windows'
缩进不对,我之前也遇到了同样问题,用autopep8解决的:
pip install autopep8autopep8 -i -a /path/to/xxx.py