为什么会这样呢? (itertools.permutations)

时间:2020-02-23 03:40:35

标签: python-3.x itertools

我希望得到0.01到0.1的排列

  list(itertools.permutations(np.arange(0.01, 0.1, 0.01), 2))

我想要的结果...

[(0.01,0.02), (0.01,0.03), (0.01,0.04), (0.01,0.05), (0.01,0.06), (0.01,0.07), (0.01,0.08), (0.01,0.09), ............]

实际结果...

[(0.01,0.02), (0.01,0.03), (0.01,0.04), (0.01,0.05), (0.01,0.060000000000000005), (0.01,0.06999999999999999), (0.01,0.08), (0.01,0.09), ............]

为什么这样会出现0.06和0.07?

0 个答案:

没有答案