【发布时间】:2015-11-21 17:40:53
【问题描述】:
好吧,由于某种原因,if 语句有效,但 elif 没有.. 不知道为什么,没有语法或缩进错误,脚本运行正常但它不使用 elif没写..
代码示例:
try:
if '120' in resp.read():
print '120'
self.write_to_file('120' '\n')
return True
elif '130' in resp.read():
print '130'
self.write_to_file('130' '\n')
return True
else:
print 'no number'
return False
except:
【问题讨论】:
标签: python if-statement