摘要: http://www.cnblogs.com/xuxm2007/archive/2011/01/17/1937220.htmlhttp://www.linux-field.com/?p=15Python中执行系统命令常见方法有两种:两者均需 import os(1) os.system# 仅仅在一个子终端运行系统命令,而不能获取命令执行后的返回信息system(command) -> exit_statusExecute the command (a string) in a subshell.# 如果再命令行下执行,结果直接打印出来>>> os.system(' 阅读全文
posted @ 2014-03-07 16:34 Django's blog 阅读(626) 评论(0) 推荐(0) 编辑
摘要: 转自:http://www.oschina.net/question/234345_52660熟悉了Qt的QProcess以后,再回头来看python的subprocess总算不觉得像以前那么恐怖了。和QProcess一样,subprocess的目标是启动一个新的进程并与之进行通讯。subprocess.Popen这个模块主要就提供一个类Popen:class subprocess.Popen( args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, ... 阅读全文
posted @ 2014-03-07 15:58 Django's blog 阅读(1067) 评论(0) 推荐(0) 编辑
摘要: 使用ConfigParser来读取配置文件,经常会发现经过记事本、notepad++修改后的配置文件读取时出现下面的问题:ConfigParser.MissingSectionHeaderError: File contains no section headers.file: ../conf/mal_crawler_allcids.conf, line: 1'\xef\xbb\xbf[basic_config]\r\n'调试程序后发现文件头部被追加了信息:\xef\xbb\xbf,然后ConfigParser解析出错google了下\xef\xbb\xbf,原因:在windo 阅读全文
posted @ 2014-03-07 10:51 Django's blog 阅读(5761) 评论(0) 推荐(0) 编辑