deepin15.11 运行python代码时报错
Tofloor
poster avatar
themask9527
deepin
2020-06-28 03:26
Author
语言 python3.7.7   软件VSCODE      
运行下列代码时 总会提示    bash: 未预期的符号 `(' 附近有语法错误       而在WINdows下的VSCODE里运行则一切正常


age = 18
if age >= 18:
    print('你可以进网吧了')




Reply Favorite View the author
All Replies
avatar
叶落随风
deepin
2020-06-28 04:37
#1
In [1]: age = 18
   ...: if age >= 18:
   ...:     print('你可以进网吧了')
   ...:                                                                                 
你可以进网吧了

运行正常
Reply View the author
avatar
龙城大李
deepin
2020-06-28 04:46
#2
哈哈哈,你也遇到了。我之前给学生讲的时候也出现了这样的问题。
Reply View the author
avatar
SamLukeYes
deepin
2020-06-28 04:51
#3
要在脚本文件开头声明一下解释器,比如:
  1. #!/usr/bin/python3
Copy the Code
Reply View the author
avatar
themask9527
deepin
2020-07-23 00:59
#4
声明了解释器了  没用哈
Reply View the author
avatar
Hello
deepin
2020-07-23 01:03
#5
print和(中间有个空格
Reply View the author
avatar
Hello
deepin
2020-07-23 01:05
#6
错了,你小子缩进忘了
Reply View the author
avatar
Hello
deepin
2020-07-23 01:05
#7
诶,不对,你有缩进
Reply View the author