Disclaimer: Its a collection from lots of other site(s) and few of my notes. I would also like to declare that I am not owning lots of its content. Please feel free to contact me directly if you want me to remove any of your content, that you don't want to share to other through this blog.
Thursday, 29 December 2016
For Kid and on mac
cat tellWordsWithArgs.py
#!/usr/bin/env python
import subprocess
import sys
# Example on how to use this code:
# ./tellWordsWithArgs.py I like to eat apple
command = "say"
text = sys.argv[1:]
tc = list(text)
topCharacters = list(tc)
for characters in topCharacters:
c1 = list(characters)
for c1 in characters:
if c1 == " ":
subprocess.call([command, ",,"])
else:
subprocess.call([command, c1])
#Changing list to string again.
text=''.join(text)
subprocess.call([command, text])
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment