In Python
>>>
What is the meaning of the above prompt?
In a textbook
>>12+22
34
It was written like this, but I think this is the same for the following cases.What's the difference?
12+22
34
The Python documentation contains a description.
2.Using the Python Interpreter
2.1.2.Interactive Mode
If the interpreter is reading instructions from a terminal (tty) or command prompt, the interpreter is said to be operating in interactive mode. In this mode, the interpreter prompts the user to enter the command by displaying a primary prompt.The primary prompt is usually three 大large symbols 」 (>>>
).In the continuous line, the interpreter displays a secondary prompt.The secondary prompt is three dots (...
) by default. The interpreter prints a launch message that begins with the version number and copyright notice before issuing the first prompt:
According to the above description, >>>
is a combination of ...
to indicate the state at which the command was entered.
>>>
is the initial input state, and nothing was entered before that, and it is the basic state that requires no indentation or parenthesis/quotation to be closed.
If the prompt changes to ...
, indentation is required in the if
or for
statements, or the statements and expressions are not completed in the middle of the input.
By the way, the expression where you enter the prompt seems a little vague, and it can also be taken as if the person you are manipulating needs to key in
>>
.
The Python interpreter is doing the prompt.
The reason >>>
is written in textbooks and other materials is probably because the Python interpreter directly reflects what the operator is seeing to prompt (that's what the word prompt means).
I think >>>
indicates that it is running in interactive mode.
It's not the code of the program.
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
581 PHP ssh2_scp_send fails to send files as intended
911 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.