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.
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.
The command line mode cannot be copied directly, you have to type line by line
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.
You pasted and copied the entire paragraph, right? After typing the first sentence, press Enter, and then you can paste and copy the rest.
Just use ipython
Then you can copy the code directly with %paste
If you are lazy, just add;
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.