Created
April 20, 2011 18:02
-
-
Save brettkelly/932159 to your computer and use it in GitHub Desktop.
Select a random snippet and write it to STDOUT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import random, sys | |
# define our list of candidate snippets | |
s = ["%snippet:typo1%","%snippet:typo2%","%snippet:typo3%"] | |
# select one at random and write it to STDOUT | |
sys.stdout.write(random.choice(s)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Your snippet is a helpful text expander snippet. For whatever reason, I needed to modify the code just slightly before I got it to work:
!/usr/bin/python
import random
L = [",,bren",",,adp",",,sbio",",,gmail"] # pre-selected snippets
l = "%snippet:"+random.choice(L)+"%"
print(l)