-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!

3
  • Duplicate for stackoverflow.com/questions/706989/… Commented Jul 19, 2015 at 10:57
  • result of what? show your code and output that you expect Commented Jul 19, 2015 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). Commented Jul 19, 2015 at 11:18

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

2 Comments

So I can't invoke the command prompt to display the result using python script?
Yes, I want to run the code in IDE but wants the result in windows command prompt. Is it possible?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.