Last active
January 4, 2016 04:29
-
-
Save ryonsherman/d079d24e53b84c55c0ae to your computer and use it in GitHub Desktop.
Console `fortune` command output
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 python2 | |
from subprocess import Popen, PIPE | |
def fortune(db=''): | |
f = Popen(['fortune', db], stdout=PIPE).communicate()[0] | |
return unicode(f).strip().encode('ascii', 'xmlcharrefreplace') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exposing method to Jinja template environment