I’m trying to read a file using Python
open('/Desktop/test.csv','rb').read()[1:15]
and I get returned something like:
'\xfeY\x00!\x00B\x00L\x00-\x00 \x00B'
Even though when I open test.csv in a text editor it is in a readable string format. Does anyone know what format this is and how to convert it back to string characters? Thanks!
The file is encoded with UTF-16.
Or, if you’re still using older Python versions,
Also note that Python uses zero-based indexing, like most other languages (C, Java, C#, JavaScript, etc…)