摘要: importoswhileTrue:filename=input('Pleaseenterthefilename')ifos.path.exists(filename):print('thefileisexist')breakelse:all=[]whileTrue:content=input('>... 阅读全文
posted @ 2015-02-04 18:50 Dus 阅读(317) 评论(0) 推荐(0) 编辑
摘要: 1、进入root家目录 建立.tab文件.tab文件内容如下:##############################################import sysimport readlineimport rlcompleterimport atexitimport osreadline... 阅读全文
posted @ 2015-02-04 17:28 Dus 阅读(364) 评论(0) 推荐(0) 编辑
摘要: 1、如何用Python删除一个文件os.remove(filename)或者os.unlink(filename)。2、Python如何copy一个文件shutil模块里有一个copyfile函数可以实现文件的拷贝。 阅读全文
posted @ 2015-02-04 14:25 Dus 阅读(522) 评论(0) 推荐(0) 编辑
摘要: import osif os.geteuid() != 0:print "This program must be run as root. Aborting."sys.exit(1) 阅读全文
posted @ 2015-02-04 14:04 Dus 阅读(1581) 评论(0) 推荐(0) 编辑
摘要: 1、Python输出中文怎么解决方法一:用encode和decode如:import os.pathimport xlrd,sysFilename=’/home/tom/Desktop/1234.xls’if not os.path.isfile(Filename):raise NameError,... 阅读全文
posted @ 2015-02-04 14:01 Dus 阅读(397) 评论(0) 推荐(0) 编辑