2007年03月04日 星期日 12:40
ÏÂÃæµÄ×ö·¨²»ÐÐѽ£¡£º³ö´í£º
IOError: [Errno 9] Bad file descriptor
>import sys
>sys.stdout=open("c:/log.txt",'wb')
> ÎÒÏëÖØ¶¨Ïòprintº¯Êý£¬Ê¹£ºprint "python" Óï¾ä°ÑÄÚÈÝдµ½Ò»¸öÎļþÖУ¡
--
×¢ÒâÉíÌ壬ÉíÌåÊǸïÃüµÄ±¾Ç®£¡£¡
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070304/76828f7c/attachment.html
2007年03月04日 星期日 13:02
f = open("c:/log.txt",'wb')
print >>f, "blah, blah, blah"
On 3/3/07, jessinio smith <jessinio在gmail.com> wrote:
> 下面的做法不行呀!:出错:
>
> IOError: [Errno 9] Bad file descriptor
>
>
> >import sys
> >sys.stdout=open("c:/log.txt",'wb')
>
>
> > 我想重定向print函数,使:print "python" 语句把内容写到一个文件中!
> --
> 注意身体,身体是革命的本钱!!
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to
> python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to
> python-chinese-request在lists.python.cn
> Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>
Zeuux © 2025
京ICP备05028076号