热门标签
更多>
搜索结果
查询Tags标签: MyRange,共有 2条记录-
python 自定义MyRange 2(yield)
class MyRange:def __init__(self, stop):self.__stop = stopdef __iter__(self):# yield 作用:将下列代码改为迭代器模式的代码# 生成迭代器代码 的的大致规则# 1.将yield以前的语句定义在next方法中# 2.将yield后面的数据作为next方法返回值number = 0while number <…
2021/11/28 22:11:20 人评论 次浏览 -
python 自定义MyRange 2(yield)
class MyRange:def __init__(self, stop):self.__stop = stopdef __iter__(self):# yield 作用:将下列代码改为迭代器模式的代码# 生成迭代器代码 的的大致规则# 1.将yield以前的语句定义在next方法中# 2.将yield后面的数据作为next方法返回值number = 0while number <…
2021/11/28 22:11:20 人评论 次浏览