我有一个关于编码/解码的问题。
我从文件中读取文本,将其与数据库(Postgres)中的文本进行比较。
比较是在两个列表之间进行的。
从文件中,我得到了"jo\x9a"代表"još",而从数据库中我得到了相同值的"jo\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 ]
如何解决这个问题?在比较这两个字符串时应该设置哪种编码来解决该问题?谢谢。