Advertisement
outerspec

drilrandom.py

Jan 15th, 2024
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. # Author:               outer_spec
  2. # Creation Date:        March 18, 2023
  3. # Filename:             drilrandom.py
  4. # Purpose:              This program reads a file containing every dril tweet and outputs a random tweet from the file.  
  5.  
  6. import random  
  7. f = open("dril10000random.txt")  #open the file
  8. lines = f.readlines() #read the file into a list  
  9.  
  10. a = random.randint(1,len(lines))
  11. randline = a-1 #create a random number  
  12. print(lines[randline])
  13.  
  14. # https://dril.gumroad.com/l/dril10000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement