How do I execute another program within a python program?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Aziz

    How do I execute another program within a python program?

    I'm very new to python (about two days experience) and have made a few basic programs so far. Now I want to try to make a program in which the user will input a file name and the file will execute, but I haven't been able to find the last piece I need.

    So far I have a basic:
    Code:
    print "Enter program name.\nFor a list of programs type 'List'" #intro text
    program = raw_input("Program: ") #asks user for program
    while program == "List": #lists program names
        print "Collatz.py"
        #the program list continues with a few more names
        program = raw_input("Program: ") #asks for new input
    I have tried maybe 50 different ways to get the program inputted to function but I can't seem to make it work.
Working...