python如何故意留下缩进行空白?
发布时间:2020-12-20 11:34:44 所属栏目:Python 来源:网络整理
导读:for line in sys.stdin: line = line.strip() uid,profile = line.split('t') try: process(profile) except: # do nothing and skip this profile 我想跳过所有抛出异常的配置文件.但是python给了我 IndentationError: expected an indented block 在“#什
for line in sys.stdin: line = line.strip() uid,profile = line.split('t') try: process(profile) except: # do nothing and skip this profile 我想跳过所有抛出异常的配置文件.但是python给了我 IndentationError: expected an indented block 在“#什么都不做,跳过这个配置文件”这一行. 我怎么告诉python什么都不做? 解决方法
Python“NOP”是
pass
... except: pass 也就是说,从不使用裸露的条款.他们捕获的东西就像你几乎绝对不想自己处理的KeyboardInterrupt.如果没有什么特定的,你可以捕捉,除了例外 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |