当前位置:网站首页>已解决SyntaxError: invalid character in identifier
已解决SyntaxError: invalid character in identifier
2022-07-29 13:40:00 【无 羡ღ】
已解决SyntaxError: invalid character in identifier
报错代码
粉丝群一个小伙伴提出的问题:
age = 10
if age > 1:
print("年龄大于1")
else:
print("年龄小于1")
print("Hello ", age)
可以看到他的代码有高亮:

报错信息:
File "E:/Python学习/2.py", line 6
print("Hello ", age)
^
SyntaxError: invalid character in identifier
报错翻译
报错内容翻译:
语法错误:标识符中的字符无效
报错原因
具体报错原因:print语句中逗号原因,粉丝不仔细写成了中文逗号
解决方法
修改代码为英文逗号即可:
age = 10
if age > 1:
print("年龄大于1")
else:
print("年龄小于1")
print("Hello ", age)
修改后运行成功:

边栏推荐
- What is the difference between the legendary server GOM engine and the GEE engine?
- 九种方式,教你读取 resources 目录下的文件路径
- The 10,000-character long article reveals the secrets of Huawei's data governance system!
- JS_ deleting the invalid data in the array undefined '0' null false NaN
- How much do you know about futures contracts
- R Error in :missing values are not allowed in subscripted assignments of data frames
- 了解 AQS 底层原理
- 分布式事务方案
- 推荐几款2022年好用的设备管理系统(软件)
- 第二轮Okaleido Tiger热卖的背后,是背后生态机构战略支持
猜你喜欢
随机推荐
【LeetCode】Day106-单词规律
How to set the explosion rate of legendary humanoid?Humanoid increase tutorial
栈题目:标签验证器
R Error in :missing values are not allowed in subscripted assignments of data frames
HCIP第十三天笔记(BGP的路由过滤、BGP的社团属性、MPLS)
Leetcode65. 有效数字
TAP 文章系列-10 | 从应用感知能力谈 TAP 的约定服务
从KEIL仿真界面导出数据的技巧
frp-免费内网穿透
无线传感器网络定位综述
程序员是职业病高发群体,别天真的以为只有秃头那么简单,才不是呢。
搞直播啦,千视超高清4K NDI编解码器8月3日19:00准时开播
leetcode linked list topic
如何成为一名获得 Adobe 国际认证的专业设计师?
基于降噪自编码器与改进卷积神经网络的采煤机健康状态识别
多人协作开发出现代码冲突,如何合并代码?
手摸手写一个互联网黑话生成器
Understand the yolov7 network structure
基于对象的实时空间音频渲染丨Dev for Dev 专栏
1184. 欧拉回路









