我有一個涉及編碼/解碼的問題。 我從文件中讀取文本,並將其與文本從數據庫(Postgres的) 比較從文件兩份名單python 2.7編碼解碼
內完成,我得到「喬\ x9a」爲「喬斯」,並從數據庫中,我得到「喬\ XC5 \比較xa1「爲相同的值
common = [a for a in codes_from_file if a in kode_prfoksov]
# Items in one but not the other
only1 = [a for a in codes_from_file if not a in kode_prfoksov]
#Items only in another
only2 = [a for a in kode_prfoksov if not a in codes_from_file ]
如何解決這個問題?比較這兩個字符串以解決問題時應該設置哪種編碼?
謝謝
OP來自斯洛文尼亞,所以Windows-1250比Windows-1252更安全。 – 2012-03-21 10:03:11
@TadeuszA.Kadłubowski好的,謝謝。編輯。 – jofel 2012-03-21 10:04:23