call shell from python

Discussion in 'Python' started by contro opinion, Feb 12, 2013.

  1. >>> import os
    >>> os.system("i=3")

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


    0
    how can i get the value of i?
     
    contro opinion, Feb 12, 2013
    #1
    1. Advertising

  2. contro opinion

    Guest

    On Tuesday, February 12, 2013 6:13:38 AM UTC+1, contro opinion wrote:
    > >>> import os
    > >>> os.system("i=3")

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

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


    You may want to take a look at the pexcpect module : http://www.noah.org/wiki/pexpect
     
    , Feb 12, 2013
    #2
    1. Advertising

  3. contro opinion

    Guest

    On Tuesday, February 12, 2013 6:13:38 AM UTC+1, contro opinion wrote:
    > >>> import os
    > >>> os.system("i=3")

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

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


    You may want to take a look at the pexcpect module : http://www.noah.org/wiki/pexpect
     
    , Feb 12, 2013
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    5,729
    Jonathan Bromley
    Feb 18, 2005
  2. Christian Heimes
    Replies:
    0
    Views:
    605
    Christian Heimes
    Feb 27, 2008
  3. Gerardo Herzig
    Replies:
    1
    Views:
    1,088
    Philipp Pagel
    Feb 27, 2008
  4. D'Arcy J.M. Cain
    Replies:
    0
    Views:
    869
    D'Arcy J.M. Cain
    Feb 27, 2008
  5. edwithad

    Bash shell to Python shell?

    edwithad, Sep 28, 2009, in forum: Python
    Replies:
    4
    Views:
    1,745
Loading...

Share This Page