摘要: Python3.3下测试通过获取文件大小使用os.path.getsize函数,参数是文件的路径获取文件夹大小importosfromos.pathimportjoin,getsizedefgetdirsize(dir):size=0.0forroot,dirs,filesinos.walk(dir):size+=sum([getsize(join(root,name))fornameinfiles])returnsizeif__name__==“__main__”:filesize=getdirsize(r'c:\windows') print(("Thereare 阅读全文
posted @ 2013-09-04 11:08 预见者 阅读(1812) 评论(0) 推荐(0) 编辑
摘要: 在python3.3环境下1.写一个简单地Python源文件,比如test.py,内容如下:import sys, osdef test(arg1, arg2):print "begin test..."fun1('1', '2')print arg1print arg2def fun1(arg1, arg2): print arg1 print arg2if __name__ == '__main__': test(*sys.argv[1:])2, 右键test.py->Edit with IDLE进入IDLE界面,R 阅读全文
posted @ 2013-09-04 11:04 预见者 阅读(1793) 评论(0) 推荐(0) 编辑
摘要: http://www.vimer.cn/2010/12/%E5%9C%A8python%E4%B8%AD%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E4%BD%8D%E7%BD%AE%E6%89%80%E5%9C%A8%E7%9A%84%E8%A1%8C%E5%8F%B7%E5%92%8C%E5%87%BD%E6%95%B0%E5%90%8D.html对于python,这几天一直有两个问题在困扰我:1.python中没办法直接取得当前的行号和函数名。这是有人在论坛里提出的问题,底下一群人只是在猜测python为什么不像__file__一样提供__line__和__ 阅读全文
posted @ 2013-09-04 11:01 预见者 阅读(1315) 评论(0) 推荐(0) 编辑