|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#统计当前目录下每个文件大小
f = input('请输入您要查询的目录(格式为''C:\\A\\B''):')
import os
a = os.listdir(f)
for m in a:
if os.path.isfile(m) :
os.path.getsize(m)
print('%s的大小是%d字节。' %(m,os.path.getsize(m)))
结果是这样报错的:
Traceback (most recent call last):
File "C:\Users\user\Desktop\简明Python教程\教学视频作业保存\030作业0统计文件.py", line 23, in <module>
os.path.getsize(m)
File "D:\Python34\lib\genericpath.py", line 50, in getsize
return os.stat(filename).st_size
FileNotFoundError: [WinError 2] 系统找不到指定的文件。: 'SanDiskSecureAccessV2_win.exe'
请问是啥问题,为啥找不到文件了都!!1
|
|