摘要:
1、python中处理异常的方式#coding:utf8filename=raw_input("请输入你要操作的文件")try: f=open(filename) print 'hello'except IOError,msg: print "你指定的文件不存在"except Na... 阅读全文
摘要:
1、目录操作import osos.mkdir('abc') #创建abc文件tree a #查看目录结构2、目录遍历方式一:递归import osdef dirList(path): filelist=os.listdir(path) for filename in filelist... 阅读全文
摘要:
1、文件读写python进行文件读写的函数是open或filefile_handler=open(filename,,mode)(1)打开并读取文件方式一:open()fo=open('/root/test.txt')fo #查看fo信息fo.read() #读取文件内容fo.close()... 阅读全文