New to python and trying to learn the ropes of file i/o.
I am working with pulling lines from a large (2 million line) file in this format:
56fr4
4543d
4343d
5irh3
Here is the function I'm using to return a code:
def getCode(i):
with open("test.txt") as f:
for index, line in enumerate(f):
if index == i:
code = # what does it equal?
break
return code
Once the index gets to the right spot (i), what syntax do I use to set the code variable?