2006年08月02日 星期三 14:07
我是在WIN2000下使用PYTHON2.4的,用os.walk读入一个目录下的子目录和文件,然后对这些文件再做一些处理。有的时候会出错,PYTHON会在DOS窗口给些提示,哪个目录下的哪个文件出错了,但是这时的中文文件名显示的是\x...之类的,无法知道是哪个文件出错。 请问有没有办法让DOS窗口能显示出中文名或是,通过其它什么办法能转化成中文的。 谢谢。 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060802/643d525a/attachment.htm
2006年08月02日 星期三 14:08
On 8/2/06, 唐国巍 <tdavid77 at tom.com> wrote: > > > 我是在WIN2000下使用PYTHON2.4的,用os.walk读入一个目录下的子目录和文件,然后对这些文件再做一些处理。有的时候会出错,PYTHON会在DOS窗口给些提示,哪个目录下的哪个文件出错了,但是这时的中文文件名显示的是\x...之类的,无法知道是哪个文件出错。 > 请问有没有办法让DOS窗口能显示出中文名或是,通过其它什么办法能转化成中文的。 > 谢谢。 把字符串拷贝下来,然后在命令行下存为一个字符串,打印一下就行了。 如: print '\x\x\x' -- I like python! My Blog: http://www.donews.net/limodou My Django Site: http://www.djangocn.org NewEdit Maillist: http://groups.google.com/group/NewEdit
2006年08月02日 星期三 14:44
ÓÃtry¸ú×ÙÕâ¸ö´íÎó£¬È»ºóexceptÀïÃæÓÃprint´ò³öÀ´£¬¸ø¸öÀý×Ó£¬×Ô¼º·¢»Ó£º except: print 'Error:' print "%s: %s" % (sys.exc_type, sys.exc_value) Best Regards, Zachary Wu (Îâ°~ÀÚ) Software Engineer, Enterprise Content Management FVT, IBM China Software Development Lab Tel: +86 10 82782244-3235. Fax: 82782244-2886 Tie Line: 915-2244-3235 Internet: xiaoleiw at cn.ibm.com Notes ID: Xiao Lei Wu/China/Contr/IBM at IBMCN Address: 8/F, Block A, Power Creative Building, No.1, East Road, Shang Di, Beijing 100085, P.R. China python-chinese-bounces at lists.python.cn дÓÚ 2006-08-02 14:07:03: > ÎÒÊÇÔÚWIN2000ÏÂʹÓÃPYTHON2.4µÄ£¬ÓÃos.walk¶ÁÈëÒ»¸öĿ¼ÏµÄ×ÓĿ¼ºÍÎÄ > ¼þ£¬È»ºó¶ÔÕâЩÎļþÔÙ×öһЩ´¦Àí¡£ÓеÄʱºò»á³ö´í£¬PYTHON»áÔÚDOS´°¿Ú¸ø > ЩÌáʾ£¬ÄĸöĿ¼ÏµÄÄĸöÎļþ³ö´íÁË£¬µ«ÊÇÕâʱµÄÖÐÎÄÎļþÃûÏÔʾµÄÊÇ > \x...Ö®ÀàµÄ£¬ÎÞ·¨ÖªµÀÊÇÄĸöÎļþ³ö´í¡£ > ÇëÎÊÓÐûÓа취ÈÃDOS´°¿ÚÄÜÏÔʾ³öÖÐÎÄÃû»òÊÇ£¬Í¨¹ýÆäËüʲô°ì·¨ÄÜת»¯³ÉÖÐÎÄ µÄ¡£ > лл¡£_______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060802/243b7dbc/attachment.html
2006年08月02日 星期三 16:18
¹ûÈ»¿ÉÒÔ£¬Ð»Ð»ÁË¡£ ----- Original Message ----- From: Xiao Lei Wu To: python-chinese at lists.python.cn Sent: Wednesday, August 02, 2006 2:44 PM Subject: Re: [python-chinese] ÔÚDOS´°¿ÚÏÔʾÖÐÎĵÄÎÊÌâ ÓÃtry¸ú×ÙÕâ¸ö´íÎó£¬È»ºóexceptÀïÃæÓÃprint´ò³öÀ´£¬¸ø¸öÀý×Ó£¬×Ô¼º·¢»Ó£º except: print 'Error:' print "%s: %s" % (sys.exc_type, sys.exc_value) Best Regards, Zachary Wu (Îâ°~ÀÚ) Software Engineer, Enterprise Content Management FVT, IBM China Software Development Lab Tel: +86 10 82782244-3235. Fax: 82782244-2886 Tie Line: 915-2244-3235 Internet: xiaoleiw at cn.ibm.com Notes ID: Xiao Lei Wu/China/Contr/IBM at IBMCN Address: 8/F, Block A, Power Creative Building, No.1, East Road, Shang Di, Beijing 100085, P.R. China python-chinese-bounces at lists.python.cn дÓÚ 2006-08-02 14:07:03: > ÎÒÊÇÔÚWIN2000ÏÂʹÓÃPYTHON2.4µÄ£¬ÓÃos.walk¶ÁÈëÒ»¸öĿ¼ÏµÄ×ÓĿ¼ºÍÎÄ > ¼þ£¬È»ºó¶ÔÕâЩÎļþÔÙ×öһЩ´¦Àí¡£ÓеÄʱºò»á³ö´í£¬PYTHON»áÔÚDOS´°¿Ú¸ø > ЩÌáʾ£¬ÄĸöĿ¼ÏµÄÄĸöÎļþ³ö´íÁË£¬µ«ÊÇÕâʱµÄÖÐÎÄÎļþÃûÏÔʾµÄÊÇ > \x...Ö®ÀàµÄ£¬ÎÞ·¨ÖªµÀÊÇÄĸöÎļþ³ö´í¡£ > ÇëÎÊÓÐûÓа취ÈÃDOS´°¿ÚÄÜÏÔʾ³öÖÐÎÄÃû»òÊÇ£¬Í¨¹ýÆäËüʲô°ì·¨ÄÜת»¯³ÉÖÐÎĵġ£ > лл¡£_______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese ------------------------------------------------------------------------------ _______________________________________________ python-chinese Post: send python-chinese at lists.python.cn Subscribe: send subscribe to python-chinese-request at lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060802/02e10e94/attachment.html
Zeuux © 2025
京ICP备05028076号