【发布时间】:2017-02-21 16:07:06
【问题描述】:
我正在尝试创建一个“if”语句。但它返回一个错误。我在 pycharm 中尝试过同样的语句,它可以工作。
我使用 jupyter notebook 以便它在每一行告诉我任何错误。我不知道我做错了什么请帮忙。
staffid1 = input('Input your Staff id here ...')
staffid2 = input('Re-enter your staff id here to confirm...')
if staffid1 == staffid2:
print('correct, searching database')
else:
print('invalid Staff id')
print('Error #1')
这是我在做什么。
错误-
File "<ipython-input-17-76bd76303e16>", line 1
if staffid1 == Staffid2:
^
SyntaxError: unexpected EOF while parsing
提前谢谢你
【问题讨论】:
-
这是一个想法:显示错误....see here.
-
您以某种方式试图自行执行
if行,而 if 语句没有正文。 -
对不起,我不明白。在我放置打印语句的地方还有其他代码。
-
在 if 语句中添加一些 body 或者如果你想为空的话使用 pass
标签: python python-3.x jupyter-notebook