如何使用十进制range()步长值? - How to use a decimal range() step value?

问题:

Is there a way to step between 0 and 1 by 0.1? 有没有办法在0和1之间以0.1步进? spa

I thought I could do it like the following, but it failed: 我觉得我能够像下面那样作,可是失败了: .net

for i in range(0, 1, 0.1):
    print i

Instead, it says that the step argument cannot be zero, which I did not expect. 相反,它说step参数不能为零,这是我没有想到的。 code


解决方案:

参考一: https://stackoom.com/question/20DO/如何使用十进制range-步长值
参考二: https://oldbug.net/q/20DO/How-to-use-a-decimal-range-step-value
相关文章
相关标签/搜索