How can I print each individual element of a list on separate lines, with the line number of the element printed before the element? The list information will also be retrieved from a text file.
So far I have,
import sys
with open(sys.argv[1], 'rt') as num:
t = num.readlines()
print("\n"[:-1].join(t))
Which currently gives the read-out:
Blah, blah, blah
etc, etc, etc
x, x, x
But I want this read-out:
1. Blah, blah, blah
2. etc, etc, etc
3. x, x, x
Thanks for you help.