Advertisement
182days

Text File Reader (Random Lines)

May 10th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. #reads 100 random lines from a given text file.
  2. import random
  3. f=open("names.txt","r")
  4. start = input("Press the 'G' key to go!!!")
  5. if start == "g":
  6.     for x in range(0, 100):
  7.         lines = open("names.txt").read().splitlines()
  8.         myline =random.choice(lines)
  9.         print(myline)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement