I am using following snippet to read the file. It returns two different output in windows and linux server. I am using python 3.
with open('test.txt','rb') as f:
data = f.read().decode('utf-8')
print(type(data.splitlines()[34560]))
print(data.splitlines()[34560])
Result in windows:
<class 'str'>
testpair14/user_photos/images/282/original/Capture d’écran 2012-09-07 à 2.50.31 PM20120917-37935-13g7sn1-0_1347875141.png
Result in Linux:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode characters in position 53-54: ordinal not in range(128)
What could be the reason for this? Please suggest.