简体   繁体   English

python 2.6 - 打印法语字符

[英]python 2.6 - print French characters

My question regarding printing French characters with python 2.6.我关于用 python 2.6 打印法语字符的问题。 There is no problems when I use python 3.4 but I need using python 2.6!当我使用python 3.4时没有问题,但我需要使用python 2.6! Instead of société mère I've got société mère etc. I already tried:而不是 société mère 我有 société mère 等。我已经尝试过:

#!/usr/bin/python
# coding=utf-8
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -*- coding: iso-8859-1 -*-

without success.没有成功。 I create a .csv file and need to fill headings with French titles.我创建了一个 .csv 文件,需要用法语标题填充标题。 Also, some French characters will be input from .xml file.此外,一些法语字符将从 .xml 文件中输入。

Thanks in advance提前致谢

Try prefixing your string literals with u:尝试使用 u 为字符串文字添加前缀:

print u'société mère'

Docs: https://docs.python.org/2/howto/unicode.html文档: https : //docs.python.org/2/howto/unicode.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM