python - 在python中打破if语句
问题描述
我想打破 if 语句。
我的代码是这样的:
if a == 0 or d == 0:
while a>0:
d=a//b
c+=1
a=d//b
c+=1
break
我收到一个错误,叫做'break' outside loop
我能做什么。
解决方案
您不能“破坏” if 语句。你可以“打破”while循环。您可以在 while 循环中添加“if”语句来中断它
推荐阅读
- sql - SQL - 连接三个表
- python - 对pyspark中的值进行排序的RDD操作
- xslt - XSLT 过滤节点多个条件
- python - PyNaCl 是必需的,但它已经安装了,如何解决?
- ruby-on-rails - 设计验证后重定向
- python-3.x - python Pandas过滤列名中具有特定子字符串的列
- c# - Windows 窗体计时器不等待方法返回
- perl - Perl Text::Unidecode 没有产生正确的输出
- python - Python Launcher 没有响应 Pygame
- python - 使用 BackgroundSubtractorMOG2 时制作前景的完整遮罩