Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I prevent my Python application from automatically closing once reaching the end of code? [duplicate]

I'm new to programming, especially Python. I'm trying to make an application that converts Fahrenheit to Celsius, but I don't know how to make the program stay open. Whenever it reaches the end of the code, it automatically closes before the user can see his or her results. I'm using Python 2.6.

like image 487
user279962 Avatar asked Oct 22 '25 23:10

user279962


1 Answers

Well, I guess you mean the terminal that Windows opens for you when you run a python file is closed too fast. You can add raw_input('Press Enter to exit') right before your program would exit. It tells Python to wait for input before exiting.

like image 192
Jochen Ritzel Avatar answered Oct 25 '25 12:10

Jochen Ritzel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!