Advertisement
182days

Text File Reader (Specific Line)

May 10th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.16 KB | None | 0 0
  1. #reads a specific line from a text file
  2. f=open("names.txt","r")
  3. x = int(input("What line would you like to read"))
  4. x = x-1
  5. lines=f.readlines()
  6. print (lines[(x)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement