Tag Archives: SyntaxError: invalid character in identifier

Solution of syntax error: invalid character in identifier when writing Python code

Solution of syntax error: invalid character in identifier when writing Python code

   this error is usually caused by illegal spaces. Some advanced editors will directly display red wavy lines to prompt for errors. However, it will not prompt in environments like jupyter notebook, so this error is caused by illegal spaces

Solution:

   delete the original space , and then use tab to regenerate the space

Development:

   other similar errors using Jupiter notebook, such as: indentation error: undintent does not match any outer indentation level, are also caused by illegal spaces in indentation

   generally, if you write code directly, this problem will not appear. The reason for the above error is that you directly copy some code from PDF document, word document or web page to python. So the fundamental way to solve this problem is to write every line of code by yourself, so this problem will not occur

SyntaxError: invalid character in identifier

Check whether there is Chinese input in the error report attachment, especially the blank space

undertake MATLAB, Python and C + + programming, machine learning, computer vision theory implementation and guidance, undergraduate and master can, salted fish trading, professional answer please go to know, for details, please contact QQ number 757160542, if you are the one

This article shares in the blog “Yu Xiaoyong” (CSDN).