Printing accented characters in Python 2.7

前端 未结 1 1334
执念已碎
执念已碎 2021-01-12 21:55

I\'m new to python. I\'m trying to print accented characters, like this:

    # -*- coding: utf-8 -*-
    print \'éàÇÃãéèï\'

But when I exec

相关标签:
1条回答
  • 2021-01-12 22:46

    As Wooble mentioned, if you change

    print 'éàÇÃãéèï'
    

    to

    print u'éàÇÃãéèï'
    

    It should work.

    Here is a good intro to unicode in python (both for 2.x and 3): The updated guide to unicode

    0 讨论(0)
提交回复
热议问题