python中的break语句时间:2023-02-07 21:02:39 break语句用在while和for循环中,用于终止循环 if __name__ == '__main__':for i in range(10):if i == 5:breakprint(i) if __name__ == '__main__':i = 0while i < 10:if i == 5:breakprint(i)i += 1