The difference between range in python2 and python3

range in python2 returns a list

range in python3 returns an iterable value

for i in range(1,10) can be used in both python2 and python3, but to generate a list of 1-10, you need to use list(range(1,10))

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324597705&siteId=291194637