PHP中文网2017-04-17 17:53:52
The command line mode cannot be copied directly, you have to type line by line
高洛峰2017-04-17 17:53:52
In fact, IDLE can only execute a single statement by default (a complete loop statement is counted as one, and IDLE is indented by default), so it is not recommended to copy multiple statements to IDLE for running.
PHP中文网2017-04-17 17:53:52
You pasted and copied the entire paragraph, right? After typing the first sentence, press Enter, and then you can paste and copy the rest.
大家讲道理2017-04-17 17:53:52
Meaning: Multiple statements were found when compiling a single statement.
Because Python is compiled one statement per line, when you paste multiple lines of code directly from some websites, the end of the line may not be 'n', so Python thinks that one line has multiple lines of statements and reports an error. You can copy it to another place first, re-edit the end of each line, just delete it and press Enter, and then run it.