Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: call shell from python

Reply
Thread Tools

Re: call shell from python

 
 
Chris Rebert
Guest
Posts: n/a
 
      02-12-2013
On Mon, Feb 11, 2013 at 9:13 PM, contro opinion <(E-Mail Removed)> wrote:
>>>> import os
>>>> os.system("i=3")

> 0
>>>> os.system("echo $i")

>
> 0
> how can i get the value of i?


Your example is too heavily contrived for me to give a much more
specific/useful answer than "use the `subprocess` module":
http://docs.python.org/2/library/sub...process-module

Of course, if all you want to do is manipulate environment variables,
then there's `os.environ`:
http://docs.python.org/2/library/os.html#os.environ

Good luck, my pseudonymous contrarian compadre.
– Chris
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash shell to Python shell? edwithad Python 4 09-28-2009 07:56 AM
Re: How to pass shell variable to shell script from python D'Arcy J.M. Cain Python 0 02-27-2008 01:56 PM
Re: How to pass shell variable to shell script from python Gerardo Herzig Python 1 02-27-2008 12:19 PM
Re: How to pass shell variable to shell script from python Christian Heimes Python 0 02-27-2008 10:53 AM
can I run unix shell command in the ModelSim shell? clinton__bill@hotmail.com VHDL 2 02-18-2005 10:04 PM



Advertisments