0

I run Python Version: 2.7.12 |Anaconda 4.1.1 (64-bit)| (default, Jun 29 2016, 11:07:13) [MSC v.1500 64 bit (AMD64)] on Windows 7 64

The problem is the following:

The code below:

c = u'\u0022\u03bd'
print c.encode('utf-8')

returns

Now, I have \u0022\u03bd in a notepad file saved with utf-8 encoding say "fl". The code below

with open(fl, 'r') as f:
    cont = f.read()
print cont
cont = unicode(cont, encoding='utf-8')
print cont.encode('utf-8')

returns

\u0022\u03bd
\u0022\u03bd

How can I convert cont to ?

akotronis
  • 230
  • 2
  • 12

0 Answers0