如何使用十進制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
相關文章
相關標籤/搜索