In Python when I use readlines() to read the contents of a .txt file created in Powershell, I get a list of stuff I do not understand.
I have tried a for loop that goes through the list of lines, and prints :D when the type(line) is str, and I have tried detecting a sub string within the lines.
Right now this is what I have:
from pprint import pprint
with open(f, "r") as file:
lines = file.readlines()
pprint(lines)
My expectation was for it to print the lines of my text file like this:
['line 1'
'line 2'
'line 3']
but instead it printed this (shortened for readability):
['ÿþ:\x00)\x00 \x00>\x00 \x00V\x00a\x00l\x00u\x00e\x00 '
'\x00d\x00o\x00e\x00s\x00 \x00n\x00o\x00t\x00 \x00m\x00a\x00t\x00c\x00h\x00 '
'\x00f\x00o\x00r\x00 '
'\x00P\x00a\x00s\x00s\x00w\x00o\x00r\x00d\x00E\x00x\x00p\x00i\x00r\x00a\x00t\x00i\x00o\x00n\x00 '
'\x00:\x00 '
'\x00']
I created the text file using Out-File in a Powershell script, is it possible that has something to do with my output?