-
Notifications
You must be signed in to change notification settings - Fork 1
Python
sipke edited this page Feb 14, 2020
·
9 revisions
import string
import random
''.join([random.choice(string.ascii_letters + string.digits + string.punctuation) for n in xrange(12)])
In [55]: ''.join([random.choice(string.ascii_letters + string.digits + string.punctuation) for n in xrange(12)])
Out[55]: '.F?3<:"INqD]'
Add the following in your python script to catch a Ctrl-C signal and allow it to be run as an application.
`` #!/usr/bin/env python3
#... your code
def signal_handler(signum, frame): sys.exit(-1)
if name == "main": import signal signal.signal(signal.SIGINT, signal_handler) #... call your code here ``