如何获得浮动范围列表?

296*_*502 1 python

如何获得浮动范围列表?为什么以下代码不起作用?

lons = list (range(80.0,90.0,0.05))

print (lons)
Run Code Online (Sandbox Code Playgroud)

Jon*_*nts 7

如果您不想编写自己的函数,可以使用takewhilecount(从2.7开始)的组合,例如:

from itertools import takewhile, count
my_range = list(takewhile(lambda L: L < 90, count(80, 0.05)))
Run Code Online (Sandbox Code Playgroud)