python 3.x - Dictionary utf-8 encoding -


i have saved dictionary on txt file(its written in greek language):

{'Μπαρτσελόνα': 'Μπαρτσελόνα', 'Οβιέδο': 'Οβιέδο'}

then trying open python:

g = open('dic.txt','r', encoding='utf-8') dic2 = eval(g.read()) g.close() 

but error message:

 ':'Όσιγιεκ','Ζάπρεσιτς':'Ίντερ Ζάπρεζιτς','Σερφίφ':'Σερίφ Τίρασπολ','Μορεϊρένσε':'Μορειρένσε','Κλουζ':'ΚΦΡ Κλουζ',     ^  syntaxerror: invalid character in identifier 

is there problem encoding?


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -