python - 如何修复 SyntaxError:Raspberry Pi 上的无效语法?
问题描述
我在 Windows 上编写了代码,编译和工作正常,但在树莓派上失败
写了一些简单的测试代码,看看它是否吐出同样的错误
a = input('this is a test string to split at space \n').split()
print(a)
输入 15:00 (需要这个数据点用于更大的项目),我得到了这个错误
15:00
Traceback (most recent call last):
File "test.py", line 1, in <module>
a = input('this is a test string to split at : \n').split(':')
File "<string>", line 1
15:00
^
SyntaxError: invalid syntax
然后在不和谐的人的要求下尝试了 15 00,得到了这个消息
15 00
Traceback (most recent call last):
File "test.py", line 2, in <module>
a = input('this is a test string to split at : \n').split(':')
File "<string>", line 1
15 00
^
SyntaxError: unexpected EOF while parsing
解决方案
推荐阅读
- python - 编写包时应该如何避免重复导入?
- java - 如何获得地图
> 来自 Java 8 中的流 - microsoft-graph-api - 如何使用 Microsoft Graph API for OneDrive 获取 mimetype 和文件 ID?
- r - R中的动态饼图使用闪亮的仪表板
- android - 使 ViewStub 覆盖 Activity
- c# - 无法确定序列化信息
- rest - 用于多个应用程序和数据库连接的烧瓶应用程序结构
- java - 在 JPA 中自动保持反向关系
- linux - Doom Emacs 中 Noto Color Emoji 和阿拉伯语之间的字体冲突
- linux - 为什么 cygwin putty cmd.exe 回滚缓冲区在 win10 上不随 GNU Screen 增长,但在 win7 上增长?