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.
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.
I think you want to print every line's ASCII equivelant and the line itself. Put the first two print
statements inside the for
loop (Indent them once).
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)
Try this: