我在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
有人在Discord上要求我尝试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