2005年10月14日 星期五 13:40
I am kinda new to python, especially when I have to process Chinese. My python script reads a few lines from a Chinese text and then split them by using white spaces as the delimiters. I got lists like: ['\xbc\xc7\xd5\xdf', '\xd0\xbb\xbd\xf0\xbb\xa2', '\xa1\xa2'] I have #-*- coding: gbk -*- on top of the script. What else do I need to do please? Thanks a lot! __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com
2005年10月14日 星期五 15:05
Hi, Have a try with UTF-8 instead of GBK.... Br/Jun ----- Original Message ----- From: "Anthony Liu" <antonyliu2002 at yahoo.com> To: <python-chinese at lists.python.cn> Sent: Friday, October 14, 2005 1:40 PM Subject: [python-chinese] Chinese display problem > I am kinda new to python, especially when I have to > process Chinese. > > My python script reads a few lines from a Chinese text > and then split them by using white spaces as the > delimiters. > > I got lists like: > > ['\xbc\xc7\xd5\xdf', '\xd0\xbb\xbd\xf0\xbb\xa2', > '\xa1\xa2'] > > I have > > #-*- coding: gbk -*- > > on top of the script. > > What else do I need to do please? > > Thanks a lot! > > > > > > __________________________________ > Yahoo! Mail - PC Magazine Editors' Choice 2005 > http://mail.yahoo.com > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > >
2005年10月14日 星期五 21:41
Hi, thanks, but it did not help. I got a list like: ['\xbc\xd3\xc7\xbf', '\xcf\xe3\xb8\xdb', '\xbe\xad\xbc\xc3'] representing the Chinese characters. --- Fatalerr <gz19990909 at 163.com> wrote: > Hi, > Have a try with UTF-8 instead of GBK.... > > Br/Jun > ----- Original Message ----- > From: "Anthony Liu" <antonyliu2002 at yahoo.com> > To: <python-chinese at lists.python.cn> > Sent: Friday, October 14, 2005 1:40 PM > Subject: [python-chinese] Chinese display problem > > > > I am kinda new to python, especially when I have > to > > process Chinese. > > > > My python script reads a few lines from a Chinese > text > > and then split them by using white spaces as the > > delimiters. > > > > I got lists like: > > > > ['\xbc\xc7\xd5\xdf', '\xd0\xbb\xbd\xf0\xbb\xa2', > > '\xa1\xa2'] > > > > I have > > > > #-*- coding: gbk -*- > > > > on top of the script. > > > > What else do I need to do please? > > > > Thanks a lot! > > > > > > > > > > > > __________________________________ > > Yahoo! Mail - PC Magazine Editors' Choice 2005 > > http://mail.yahoo.com > > _______________________________________________ > > python-chinese list > > python-chinese at lists.python.cn > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com
2005年10月14日 星期五 21:50
2005/10/14, Anthony Liu <antonyliu2002 at yahoo.com>: > I am kinda new to python, especially when I have to > process Chinese. > > My python script reads a few lines from a Chinese text > and then split them by using white spaces as the > delimiters. > > I got lists like: > > ['\xbc\xc7\xd5\xdf', '\xd0\xbb\xbd\xf0\xbb\xa2', > '\xa1\xa2'] > > I have > > #-*- coding: gbk -*- > > on top of the script. > > What else do I need to do please? > >>> a =['\xbc\xd3\xc7\xbf', '\xcf\xe3\xb8\xdb','\xbe\xad\xbc\xc3'] >>> for i in a: ... print i ... 加强 香港 经济
2005年10月14日 星期五 23:20
--- makeyunbad <makeyunbad at gmail.com> wrote: > 2005/10/14, Anthony Liu <antonyliu2002 at yahoo.com>: > > I am kinda new to python, especially when I have > to > > process Chinese. > > > > My python script reads a few lines from a Chinese > text > > and then split them by using white spaces as the > > delimiters. > > > > I got lists like: > > > > ['\xbc\xc7\xd5\xdf', '\xd0\xbb\xbd\xf0\xbb\xa2', > > '\xa1\xa2'] > > > > I have > > > > #-*- coding: gbk -*- > > > > on top of the script. > > > > What else do I need to do please? > > > > >>> a =['\xbc\xd3\xc7\xbf', > '\xcf\xe3\xb8\xdb','\xbe\xad\xbc\xc3'] > > >>> for i in a: > ... print i > ... > ¼ÓÇ¿ > Ïã¸Û > ¾¼Ã Hehe, you are smart. But do you know how to properly read and write out and display Chinese with Python? __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com
2005年10月14日 星期五 23:34
2005/10/14, Anthony Liu <antonyliu2002 at yahoo.com>: > Hehe, you are smart. But do you know how to properly > read and write out and display Chinese with Python? 你的运行环境? -- Bset Regards, Kebo Wang
2005年10月15日 星期六 00:11
2005/10/14, Anthony Liu <antonyliu2002 at yahoo.com>: > I am kinda new to python, especially when I have to > process Chinese. > > My python script reads a few lines from a Chinese text > and then split them by using white spaces as the > delimiters. > > I got lists like: > > ['\xbc\xc7\xd5\xdf', '\xd0\xbb\xbd\xf0\xbb\xa2', > '\xa1\xa2'] > > I have > > #-*- coding: gbk -*- > > on top of the script. > > What else do I need to do please? > > Thanks a lot! > try to print items of the list one by one
2005年10月15日 星期六 01:04
O, thanks. It's a Windows 2000 Server, English version, service pack 4(? forgot), but the default language is set to be Chinese (GB2312). Actually I also wanna be able to process Chinese properly on a Mandrake system. --- kebo wang <kebowang at gmail.com> wrote: > 2005/10/14, Anthony Liu <antonyliu2002 at yahoo.com>: > > Hehe, you are smart. But do you know how to > properly > > read and write out and display Chinese with > Python? > > ÄãµÄÔËÐл·¾³£¿ > > -- > Bset Regards, > Kebo Wang > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > __________________________________ Start your day with Yahoo! - Make it your home page! http://www.yahoo.com/r/hs
2005年10月15日 星期六 08:21
2005/10/15, Anthony Liu <antonyliu2002 at yahoo.com>: > O, thanks. > > It's a Windows 2000 Server, English version, service > pack 4(? forgot), but the default language is set to > be Chinese (GB2312). > Where do you want to display? ['\xbc\xc7\xd5\xdf', '\xd0\xbb\xbd\xf0\xbb\xa2','\xa1\xa2'] The list is normal in python. >>> a =['\xbc\xd3\xc7\xbf', '\xcf\xe3\xb8\xdb','\xbe\xad\xbc\xc3'] >>> f = open('d:/log.txt','w') >>> f.writelines(a) >>> f.close() When I open the file, Chinese display normal.
Zeuux © 2025
京ICP备05028076号