Created
September 9, 2016 20:56
-
-
Save perenecabuto/7daf403dfdab1f13e2cc7a7fb12f8a35 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# coding: utf-8 | |
import sys | |
import subprocess | |
import random | |
def main(msg): | |
out, err = subprocess.Popen('cowsay -l', shell=True, stdout=subprocess.PIPE).communicate() | |
files = (" ".join(out.split("\n")[1:-1])).split(" ") | |
choice = random.choice(files) | |
subprocess.call("cowsay -f {} {}".format(choice, msg), shell=True) | |
if __name__ == "__main__": | |
message = " ".join(sys.argv[1:]) | |
main(message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment