def drange(start, stop, step):
… r = start
… while r < stop:
… yield r
… r += step
…
i0=drange(0.0, 1.0, 0.1)
[“%g” % x for x in i0]
[‘0’, ‘0.1’, ‘0.2’, ‘0.3’, ‘0.4’, ‘0.5’, ‘0.6’, ‘0.7’, ‘0.8’, ‘0.9’, ‘1’]
python decimal range() step value
最新推荐文章于 2021-09-09 10:18:05 发布