Tried running this code first through powershell and then through cmd and even simply clicking it. I am typing "start python myfile.py" to run it. In each case, the file blinks on screen and immediately closes.
The only way I can view it is to drag the file directly into cmd, in which case it looks perfect.
I am doing the first exercise from "Learn Python the Hard Way". I'm doing everything to the letter as in the book, with one exception. See below*. I've read and re-read it.
I don't think this matters, but the book tells me to simply write, "python" "notepad" etc. to run those (and other) programs from my terminal. And I figured out I have to write, "start python", "start notepad", etc. for it to actually run.
As per suggestions to this problem on other similar questions here, I have attempted to end my code with 1.) main() 2.) raw_input() and
3.) if __name__ == '__main__':
main()
No success. Here is my file code which I made in Notepad++:
print "Hello World!"
print "Hello again"
print "I like typing this."
print "This is fun."
print 'Yay! Printing.'
print "I'd much rather you 'not'."
print 'I "said" do not touch this.'
So pretty much, the program executes and closes itself. How might I keep it open in python on its own?
It has been hours of trying to figure this out and this seriously seems like it should be so simple. Could someone please, pretty please, pleeeease point me in the right direction?
解决方案input("Press Enter to continue...")