10 2014 档案
摘要:vmware 虚拟机长时间不用,恢复快照时出现如下错误:An error caused the restore operation to fail. Cancel the restore operation and correct the .....Discard...Cancel....度娘没有解...
阅读全文
摘要:#WalkDir函数枚举目录中所有目录和文件,参数(枚举目录输出列表,枚举文件输出列表,要枚举的目录)def WalkDir(dirlist,filelist,dirname): try: ls=os.listdir(dirname) except: prin...
阅读全文
摘要:1. 最基本的读文件方法:file = open("sample.txt") while 1: line = file.readline() if not line: break pass # do something 一行一行得从文件读数据,显然比较慢;不过很省内...
阅读全文
摘要:一、单行注释单行注释以#开头,例如:print 6#输出6二、多行注释(Python的注释只有针对于单行的注释(用#),这是一种变通的方法)多行注释用三引号'''将注释括起来,例如:'''多行注释多行注释'''三、中文注释在文件头上写入:#coding=gbk或:#coding=utf-8虽然#这个...
阅读全文
摘要:使用正则表达式可以很好解决import res = 'Hello!This?Is!What?I!Want'ss = re.split('[!?]', s) ss = ['Hello', 'This', 'Is', 'What', 'I', 'Want']
阅读全文

浙公网安备 33010602011771号