Thread: C and Python

  1. #1
    Registered User
    Join Date
    Jul 2007
    Location
    Texas
    Posts
    103

    C and Python

    This really isn't related to C and i am sorry about that. But I didn't know who else to ask, and I figure some of you guys will know. Besides python is written in C ;]. But anyway, the system(); function in C basically lets you pass commands to either terminal or command prompt. But what is the equivalent of doing that in python? Is there one? Also, does anyone know of a good message board like this one I could join for python?


    Thanks a bunch

  2. #2
    Registered User
    Join Date
    Jul 2007
    Location
    Texas
    Posts
    103
    Okay, I think i found something.

    Code:
    import os
    os.environ['USER'] = 'alex'
    os.popen('python echoenv.py').read()
    Where "python echoenv.py" is replaced with the command.

    I am talking to myself. Nobody is reading this

  3. #3
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Yep. I googled "python syntax system calls"

    http://docs.python.org/tut/node12.ht...00000000000000
    Mainframe assembler programmer by trade. C coder when I can.

  4. #4
    Registered User
    Join Date
    Jul 2007
    Location
    Texas
    Posts
    103
    ah, gracias

  5. #5
    Banned
    Join Date
    Nov 2007
    Posts
    678
    Code:
    import os
    os.system("command goes here")
    i hope it helps!

  6. #6
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Quote Originally Posted by alexnb185 View Post
    ah, gracias
    Es Nada
    Mainframe assembler programmer by trade. C coder when I can.

Popular pages Recent additions subscribe to a feed