range和xrange的区别 python3里面只有range,返回结果是一个生成器,官方文档是这样描述的 class range(object): """ range(stop) -> range object range(start, stop[, step]) -> range object Return an object that produces a sequence of integers from start (inclusive) to sto…
先来看看range与xrange的用法介绍 help(range)Help on built-in function range in module __builtin__: range(...) range(stop) -> list of integers range(start, stop[, step]) -> list of integers Return a list containing an arithmetic progression of integers. range(i…