Q:

How to use python to write a linux shell command?

I want to use python to write a shell command... that I can customize some paths in my config file, that I can "shortcut" to these paths directly, not need to "cd" and "cd" again and again...
I want to use python, because I don't know anything about bash. Is that possible ?if yes, could you give me any idea about how to use python to fullfill this shell command...
Thanks !

A:

You have to give a look to the os library of python https://docs.python.org/2/library/os.html
The os.path module helps you to deal with paths. https://docs.python.org/2/library/os.path.html#module-os.path
With the subprocess module you can also execute commands, configure timouts (if the command hangs out), check the result, etc https://docs.python.org/2/library/subprocess.html

