By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,400 Members | 903 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,400 IT Pros & Developers. It's quick & easy.

How do I execute another program within a python program?

P: n/a
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:
Expand|Select|Wrap|Line Numbers
  1. print "Enter program name.\nFor a list of programs type 'List'" #intro text
  2. program = raw_input("Program: ") #asks user for program
  3. while program == "List": #lists program names
  4.     print ""
  5.     #the program list continues with a few more names
  6.     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.
Oct 16 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.