简体   繁体   中英

python 2.6 - print French characters

My question regarding printing French characters with python 2.6. There is no problems when I use python 3.4 but I need using python 2.6! Instead of société mère I've got société mère etc. I already tried:

#!/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. Also, some French characters will be input from .xml file.

Thanks in advance

Try prefixing your string literals with u:

print u'société mère'

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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