Advertisement
182days

Typewriter Text

May 10th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. lines = ["You have woken up in a mysterious maze",
  2.          "The building has 5 levels",
  3.          "Scans show that the floors increase in size as you go down"]
  4.  
  5. from time import sleep
  6. import sys
  7.  
  8. for line in lines:          # for each line of text (or each message)
  9.     for c in line:          # for each character in each line
  10.         print(c, end='')    # print a single character, and keep the cursor there.
  11.         sys.stdout.flush()  # flush the buffer
  12.         sleep(0.1)          # wait a little to make the effect look good.
  13.     print('')               # line break (optional, could also be part of the message)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement