-
Python超菜鸟问题没反应过来怎么回事Pythoncodelist_1=['a','c','c']foriinlist_1:print('beforeprocess,list_1is',list_1)ifi=='c':list_1.remove(i)print('afterprocess,list_1is',list_1)oasistree 时间:10-26 + 阅读全文
-
pyhton中的文件对象打开后是否必须要close()[有示例]?下面是书上的一个生成器表达式,获取文件中最长的行:Pythoncodereturnmax(len(x.strip())forxinopen('etc/motd'))感觉很奇怪,文件打开后没有调用close(),是不是不需要啊?Dic4000 时间:10-26 + 阅读全文
-
Perl s/// 和 $1 的问题我想让$line中出现return0;如何修改程序才能实现呢?Perlcode$line="ret0";$p="ret(.+)";$fun="return$1";$line=~s/$p/$fun/;print"$line\n";proorck6 时间:10-26 + 阅读全文
-
python字典中使用字符串格式符的问题在交互式解释器中执行下面语句Pythoncodett={1:'abc',2:'cde',3:'fgh'}print"%(1)s,%(3)s"%tt报错:Traceback(mostrecentcalllast): File"<pyshell#54>",line1,in<module> prDic4000 时间:10-25 + 阅读全文
-
python中Utf-8字符集的问题Pythoncodech1=u"严"ch1#显示的是:u'\xd1\xcf'printch1#显示的是乱码ch1.getEncode("utf-8")#显示的是:'\xc3\x91\xc3\x8f'问题:1:第二行与第一行显示的编码为什么不一样?它们分别代表什么?2:第三行显示的是乱码,我认为可能是print只能接受Ansi编码,那么怎样Dic4000 时间:10-25 + 阅读全文
-
wxPython怎么实现TabPanel?wxPython怎么实现TabPanel?wxPython怎么实现TabPanel?wxPython怎么实现TabPanel?xuwenhao2002 时间:10-25 + 阅读全文
-
请教python subprocess的问题本帖最后由guo9902于2010-10-2212:26编辑请教一下各位大牛我写了一个python脚本,会使用subprocess模块调用外部命令,这个python脚本每十分钟被一个程序调度一次,运行1,2天之后,就会有这样的报错,请帮忙看看是怎么回事,谢谢!相关代码是p=subprocess.Popen(self.cmd,shell=True,close_fds=Tguo9902 时间:10-22 + 阅读全文