By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,002 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,002 IT Pros & Developers. It's quick & easy.

Forking? Calling unix commands from python

P: 14
Hey all!

Just doing some tinkering with python. I am running mac os x and I am wondering how I can call unix commands from python. In C I think I would use a fork, although it has been sometime since I have used C so I am a little fuzzy on the syntax.

I also want to use what the unix command returns.

Example:

Typed in the command line: python myProgram.py

myProgram.py needs to call the unix ls command and it needs to read in the output from the ls command.

If someone could give me a link or tell me what term I should search for that would be super. Did some searching but wasnt really sure what to search for.

Thanks all! Have a great night!

JS
Dec 19 '08 #1
Share this Question
Share on Google+
2 Replies


Smygis
100+
P: 126
Ether use the commands module or os.popen. And the first is a wrapper of the later.
Dec 19 '08 #2

P: 14
THanks! I will investigate!
Dec 19 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.