Possible Duplicate:
Converting a latin string to unicode in pythonunicode字符串轉換爲原始格式
我有以下格式列表中文件
list_example = [
u"\u00cdndia, Tail\u00e2ndia & Cingapura",
u"Lines through the days 1 (Arabic) \u0633\u0637\u0648\u0631 \u0639\u0628\u0631 \u0627\u0644\u0623\u064a\u0627\u0645 1",
]
但在列表中的字符串的實際格式存儲之後
actual_format = [
"Índia, Tailândia & Cingapura ",
"Lines through the days 1 (Arabic) سطور عبر الأيام 1 | شمس الدين خ "
]
如何將list_example
中的字符串轉換爲actual_format
列表中的字符串?
格式已經是正確的.. 。嘗試'print list_example [1]' – JBernardo
注意:您需要將'.encode()'list_example [1]'編碼爲終端可以識別的編碼,具體取決於您的區域設置。 – geoffspear
但是當我嘗試 –