What I have tried to do:
f = open('j:/text.txt', 'r')
lines = []
for line in f:
lines.append(line)
print (''.join(str(ord(c)) for c in line))
print (line)
print (lines)
But this converts only the last line and ignores the previous ones.
Try this:
with open('j:/text.txt', 'r', encoding="ascii") as file :
lines = f.readlines()
for line in lines:
line = line.replace("\n", "")
print(''.join(str(ord(c)) for c in line))