Skip to content

Instantly share code, notes, and snippets.

@beefy
Last active September 14, 2017 18:55
Show Gist options
  • Save beefy/ab8472139cdfaa113b56af5196145652 to your computer and use it in GitHub Desktop.
Save beefy/ab8472139cdfaa113b56af5196145652 to your computer and use it in GitHub Desktop.
prints the current time
import time
import datetime
CURSOR_UP_ONE = '\x1b[1A'
ERASE_LINE = '\x1b[2K'
time_format = ['%I:%M:%S %p','%I %M %S %p']
while (True):
print CURSOR_UP_ONE + ERASE_LINE + CURSOR_UP_ONE
print datetime.datetime.now().strftime(time_format[0])
time_format.reverse()
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment