Skip to content

Instantly share code, notes, and snippets.

@telmotrooper
Last active May 21, 2016 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save telmotrooper/62f2745f3aa5d3d2405f5301370eed00 to your computer and use it in GitHub Desktop.
Save telmotrooper/62f2745f3aa5d3d2405f5301370eed00 to your computer and use it in GitHub Desktop.
Reads a random message from a file and prints it
"Reads a random message from a file and prints it"
from random import randint
with open("antichamber.txt") as file:
messages = file.readlines()
file_title = messages[0].replace("\n","")
random_number = randint(1, len(messages)-1)
random_message = messages[random_number].replace("\n","")
print("Reading from", file_title)
print(random_message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment