anonymous
  • anonymous
I am very new, and am attempting to learn the Python language so please forgive my ignorance.Here is the problem, whenever I run a Python script from the cmd prompt as soon as it runs it (cmd prompt screen) dissappears immediately after running. How do you keep the cmd screen open with whatever the last print command has on screen ?
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
shadowfiend
  • shadowfiend
I think if you right-click on the file and go to its properties you may have an option. There are two better ways to do it. One is to run it from an already-open command prompt; e.g., hit Windows-R to bring up the run dialog, type `cmd' and enter to bring up a command prompt, then type `cd C:\' where is the folder where your file is, and then run `python myfile.py'. The second way is to make it so that your script itself waits for you to hit enter before it quits. I believe the way to do that in Python is to put a single `raw_input' statement at the end of the file. That will wait for you to hit enter before the script ends, and therefore before the command prompt closes.
carlsmith
  • carlsmith
raw_input() will work fine for that.
anonymous
  • anonymous
Thanks for the help i'll give it a try.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
the raw_input() works Thank you
shadowfiend
  • shadowfiend
Awesome! :)
carlsmith
  • carlsmith
@rcvegas40 I've been learning Python for a couple of years, I'm not brilliant at it, but I've got it down. If you have any problems at all, just post a question in the Computer Science Group or the MIT 6.0 Group and I'd be happy to help. There's a couple of other guys on here too. They'd be happy to help if you need anything. Welcome to the site by the way :)

Looking for something else?

Not the answer you are looking for? Search for more explanations.