Python: Error SyntaxError: Invalid Syntax's Summary Summary

created at 06-24-2021 views: 3

I learned Python today, but I just started a problem, I didn't have a problem, but I will display "SyntaxError: Invalid Syntax every time."

"SyntaxError: invalid syntax" means syntax errors; the query solves this problem, so summarizes a solution to this problem:

Version problem:

Because Python2 and Python3 are not compatible, some code that can run on Python2 is not necessarily running on Python3; you can try to replace the version;

Path question:

Remember to check if your path is correct;

Carelessness problem

  • Forgot to add a colo : after if , elif , else , for , while , class ,def statements;
  • use = as ==;
  • didn't close a parenthesis like ( or).

When installing a third-party module:

"SyntaxError: Invalid Syntax" may appear when installing a third-party module, then you need to check if you are installed under the CMD window, at the same time, find the PIP The installation inside the catalog;

Please log in to leave a comment.