2005年04月13日 星期三 09:54
python-chinese : 大家好! a = "中文" a 的值是 '\xd6\xd0\xce\xc4' 如果把a写入文件,怎样把 \xd6\xd0\xce\xc4 转换成真正的汉子呢? 谢谢! Carambo , qutr at tjub.com.cn 2005-4-13 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050413/d3381b43/attachment.html
2005年04月13日 星期三 10:29
呵呵,你就把这些值写入文件就行了
file("test.txt","w").write(a)
On 4/13/05, Carambo <qutr at tjub.com.cn> wrote:
>
> python-chinese :
>
> 大家好!
> a = "中文"
> a 的值是 '\xd6\xd0\xce\xc4'
> 如果把a写入文件,怎样把 \xd6\xd0\xce\xc4 转换成真正的汉子呢?
> 谢谢!
> Carambo, qutr at tjub.com.cn
> 2005-4-13
>
> _______________________________________________
> python-chinese list
> python-chinese at lists.python.cn
> http://python.cn/mailman/listinfo/python-chinese
>
>
>
--
茫茫人海,你是我的最爱
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050413/9ffff61e/attachment.htm
2005年04月13日 星期三 10:37
On 4/13/05, Carambo <qutr at tjub.com.cn> wrote: > > a = "中文" > a 的值是 '\xd6\xd0\xce\xc4' > 如果把a写入文件,怎样把 \xd6\xd0\xce\xc4 转换成真正的汉子呢? > 这四个字节想变成真正的汉子,挺难,男子汉不是那么好当的;p '\xd6\xd0\xce\xc4'就是"中文"这两个汉字的GB18030编码啊,如果你要存的文件是GB18030编码的,就直接把这四个字节写进去好了。如果你要存的文件是别的编码,就先转成别的编码再存。 -- Qiangning Hong Get Firefox! < http://www.spreadfirefox.com/?q=affiliates&id=67907&t=1> -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050413/6214d8a5/attachment.html
Zeuux © 2025
京ICP备05028076号