python 错误 SyntaxError: invalid character in identifier

即“标识符中的无效字符”。
有些编译器会报错,比如pycharm。但是jupyter等等,运行后才会显示如上错误。
仔细检查一下代码中有没有中文字符,一般来说是分号(;;)等等,也要注意tab和四个space是不一样的。(虽然看起来一样╯^╰)

同理,报错IndentationError: expected an indented。也是缩进的问题,一定特别注意函数中的return。

猜你喜欢

转载自blog.csdn.net/weixin_38648232/article/details/85062809