Skip to content

Instantly share code, notes, and snippets.

@oyakata
Created December 13, 2016 08:47
Show Gist options
  • Save oyakata/0814772e26a9a24b0b2a5c773f1dcf21 to your computer and use it in GitHub Desktop.
Save oyakata/0814772e26a9a24b0b2a5c773f1dcf21 to your computer and use it in GitHub Desktop.
シバンとANSIエスケープコードのサンプル
#!/usr/bin/python
from datetime import datetime
import time
import itertools
import sys
c = itertools.count()
out = sys.stdout
for x in c:
# "\033[31mFFF\033[0m"
out.write("\033[2K\033[G" + '{}> \033[31m{}\033[0m'.format(datetime.now().strftime('%Y-%m-%d %H:%M:%S'), x))
out.flush()
time.sleep(0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment