How could I make the output of a python program as a command? For example, my python program print:and then Ubuntu shell execute the command above. Thanks!!Code:cd /home/chris/Books/2010
How could I make the output of a python program as a command? For example, my python program print:and then Ubuntu shell execute the command above. Thanks!!Code:cd /home/chris/Books/2010
See:Code:$(command)
Code:man bash | less +/"Command Substitution"
Sorry, when I add the code below in my python program, it doesn't work as I thought:
print "$ cd /home/chirs/book/2010"
anything I did wrong?
Sorry, when I add the code below in my python program, it doesn't work as I thought:
anything I did wrong?Code:print "$ cd /home/chirs/book/2010"
help please ......
Oh, you want something like:
http://docs.python.org/tutorial/stdl...stem-interfaceCode:import os cmd='ls -al /home' os.system(cmd)
Bookmarks