python – 随机缩进错误?
发布时间:2020-12-20 11:06:53 所属栏目:Python 来源:网络整理
导读:参见英文答案 I’m getting an IndentationError. How do I fix it?????????????????????????????????????4个 这是我的代码: def options(): selection=int(input("#")) if selection == 1: #Connect elif selection == 2: #Modules print("Modules") elif
参见英文答案 >
I’m getting an IndentationError. How do I fix it?????????????????????????????????????4个
这是我的代码: def options(): selection=int(input("#>")) if selection == 1: #Connect elif selection == 2: #Modules print("Modules") elif selection == 3: #Checking Internet checkInternetConnection() elif selection == 99: #Exit shutdown() else: print "Unknown Option Selected!" sleep(100) sys.clear() start() 每次我跑我得到这个错误: File "main.py",line 41 elif selection == 2: ^ IndentationError: expected an indented block 我可能在这里是一个菜鸟,但请有人帮忙吗?!谢谢 解决方法
你的if块之后必须有一个声明
注意:评论不计算在内. 例如. if statement: pass (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |