Created
September 16, 2018 20:19
-
-
Save edsoncelio/df9f8b75ff3c5c952d6d1116f1396985 to your computer and use it in GitHub Desktop.
Finding the n-th line in a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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