【问题标题】:Is there a label/goto in python? [duplicate]python中有标签/转到吗? [复制]
【发布时间】:2023-04-11 06:46:01
【问题描述】:

我们可以批量使用goto:label。 Python中有类似的东西吗?

【问题讨论】:

  • @jonno 你是说“去考虑有害”吗? :) u.arizona.edu/~rubinson/copyright_violations/… 对于那些不了解他们历史的人。
  • goto:label 批量做什么?
  • 简短回答:不。长答案:nooooooooooooooo。
  • 别再想这个了。
  • 我希望超级用户的人们在迁移之前至少粗略检查一下是否完全重复。

标签: batch-file python


【解决方案1】:

不,香草 python 中没有goto 或标签或其他等效项。

最好的办法是坚持使用常规控制流语句(例如ifelse ifelseforwhilebreakcontinue,...)和函数(也将return 添加到控制流语句列表中......)

【讨论】:

  • try, except, finally 还有一些。 . . Python 有很多选择 :-)
猜你喜欢
  • 2010-10-01
  • 1970-01-01
  • 2023-03-21
  • 2010-12-12
  • 1970-01-01
  • 1970-01-01
  • 2018-03-27
  • 2010-09-29
  • 1970-01-01
相关资源
最近更新 更多