-1

Is it possible to display the result in command prompt if I run the python code is python GUI editor?

I mean, I have a program

def sum(a,b):
    result = a+b
    print "The sum = %d." %result

sum(2,3)

Once I run this code, I'm able to get the answer in the Python Shell window

The sum = 5.

What my question was, is it possible for me to get the result in windows command prompt instead of getting the result in Python Shell window.

Thanks in advance!

SomeOne
  • 163
  • 2
  • 7
  • Duplicate for http://stackoverflow.com/questions/706989/how-to-call-an-external-program-in-python-and-retrieve-the-output-and-return-cod – Mihai8 Jul 19 '15 at 10:57
  • result of what? show your code and output that you expect – Andersson Jul 19 '15 at 11:11
  • 1
    Not clear, what you are asking. Provide more explicit example of what you want to achieve (or what you are running and where you want to display the result). – Jan Vlcinsky Jul 19 '15 at 11:18

1 Answers1

0

You can run python programs in Command Prompt by typing

Path/To/python.exe Path/To/python_script.py

which will output the answer

liamdiprose
  • 433
  • 5
  • 14