Discuss / Python / 随便写写

随便写写

Topic source

BillCode

#1 Created at ... [Delete] [Delete and Lock User]

输出全体整数

def iterator(): i=1 while True: yield i i += 1 o = iterator()

while True: try: x = next(o) print(x) except StopIteration: break

机修贾森

#2 Created at ... [Delete] [Delete and Lock User]

异常处理部分就不用加了吧,既然是全体整数,说明没有上限的...


  • 1

Reply