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
Similar Posts:
- [733]TabError: inconsistent use of tabs and spaces in indentation
- The solution to the problem of unified does not match any outer indentation level in pychar platform
- Python:IndentationError: expected an indented block
- How to Solve pylint error tab indent
- [Solved] Dom4j parsing XML file error: invalid XML character (Unicode: 0x8)
- Python–TabError: inconsistent use of tabs and spaces in indentation
- Document.body.clientheight cannot get the browser page height correctly
- [Solved] Jupyter notebook Startup Crash Error in Tensorflow Environment: ssl.SSLError: Unknow error (_ssl.c:4034)
- Python OSError: [errno 22] invalid argument: [How to Solve]
- IndentationError: unexpected indent python