嗨我想要生成从1000000到2000000数字列表,但问题是,我得到一个错误记忆错误,我正在使用随机一切都很好只有我得到dublcated号码,我不能重复数字,所以我不能切换到XRANGE data = []
total = 2000000
def resource_file(info):
with open(info, "r") as data_file:
reade
我有一个大的整数数组,和我需要打印的最大每10个整数的和与其对应的索引阵列为一对英寸 ex. (max_value, index of max_value in array)
我可以在前10个整数中成功找到最大值和相应的索引,但是我无法遍历整个数组。 我已经尝试使用: a = some array of integers
split = [a[i:i+10] for i in xrange
s = 0
for s in xrange(0, 100):
print "s before", s
if s % 10 == 0:
s += 10
print "s after", s
s = 0
while s < 100:
print "s before", s
if s % 10 == 0:
s += 1
我通过我为什么不能这样对待一个的xrange()对象作为一个迭代器有点糊涂: In [47]: xr = xrange(1,7)
In [48]: next(xr)
-----------------------------------------------------------------------
----
TypeError Traceback (most r