为什么:语法不能在linux上工作?
On MacOS
→ python3
Python 3.6.3 (default, Oct 4 2017, 06:09:38)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x : str = "hello"
>>> On Linux
→ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x : str = "hello"
File "<stdin>", line 1
x : str = "hello"
^
SyntaxError: invalid syntax
>>> 发布于 2018-01-09 04:02:23
导致这种情况的是python的版本。在Linux上也更新到3.6。核对发布说明
发布于 2018-01-09 03:54:46
这是python版本的问题所在。在linux中对3.6进行同样的尝试。
https://stackoverflow.com/questions/48161157
复制相似问题