io - Python reading from non ascii file -
i have text file contains following character: ÿ
when try , read file in i've tried both:
with open (file, "r") myfile:
and
with codecs.open(file, encoding='utf-8') myfile:
with success. when try read file in string using:
file_string=myfile.read()
or
file_string=myfile.readline()
i keep getting error:
unicodedecodeerror: 'utf-8' codec can't decode byte 0xff in position 11889: invalid start byte
ideally want ignore character or subsitute '' or whitespace
i've come solution. use python2 instead of python3. still can't seem work in python3 though
Comments
Post a Comment