Newbie question about text encoding

pierrick.brihaye at gmail.com pierrick.brihaye at gmail.com
Tue Feb 24 05:49:18 EST 2015


Hello,

Working with pyshp, this is my code :

import shapefile

inFile = shapefile.Reader("blah")

for sr in inFile.shapeRecords():
    rec = sr.record[2]
    print("Output : ", rec, type(rec))

Output:  hippodrome du resto <class 'str'>
Output:  b'stade de man\xe9 braz' <class 'bytes'>

Why do I get 2 different types ?
How to get a string object when I have accented characters ?

Thank you,

p.b.




More information about the Python-list mailing list