C and Python

This is a discussion on C and Python within the Tech Board forums, part of the Community Boards category; This really isn't related to C and i am sorry about that. But I didn't know who else to ask, ...

  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
    Katy, Texas
    Posts
    2,309
    Yep. I googled "python syntax system calls"

    http://docs.python.org/tut/node12.ht...00000000000000
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  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
    Katy, Texas
    Posts
    2,309
    Quote Originally Posted by alexnb185 View Post
    ah, gracias
    Es Nada
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21