Skip to content

Instantly share code, notes, and snippets.

@edsoncelio
Created September 16, 2018 20:19
Show Gist options
  • Save edsoncelio/df9f8b75ff3c5c952d6d1116f1396985 to your computer and use it in GitHub Desktop.
Save edsoncelio/df9f8b75ff3c5c952d6d1116f1396985 to your computer and use it in GitHub Desktop.
Finding the n-th line in a file
def search_line(i):
with open("file") as fp:
for index, line in enumerate(fp):
if index == i:
print (line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment