I’m using Python in Terminal on Mac OSX latest. When I press enter, it processes the code I’ve entered, and I am unable to figure out how to add an additional line of code e.g. for a basic loop.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In the python shell, if you are typing code that allows for continuation, pressing enter once should not execute the code…
The python prompt looks like this:
If you start a for loop or type something where python expects more from you the prompt should change to an elipse. For example:
you the prompt should turn into this
meaning that it is waiting for you to enter more to complete the code.
Here are a couple complete examples of python automatically waiting for more input before evauluation:
If you want to force python to not evaluate the code you are typing you can append a “\” at the end of each line… For example:
hope that helps.