Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

is their a way to close the IDLE shell if they input something

is there a way on IDLE to close the users shell if they were to enter something that would be supposed to "quit"?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You can use exit(0) to terminate the program, as follows:

while True:
    i = input()
    if i == "quit":
        exit(0)
    else:
        # do something
        pass

For more information about what 0 for exit() means:
Difference between exit(0) and exit(1) in Python

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading