use*_*208 5 python mongodb pymongo
我试图迭代python循环但嵌套循环没有到达增量元素.
除了使用range像"hasNext()" 之外还有什么方法吗?
cursor1 = Collection.find({x : {"$gt" : 1}})
array1 = []
array2 = []
print Collection.count()
for r in range(0, cursor1.count()):
first = cursor1.next().get("entity")
array2.append()
for z in range(len(array2)):
print len(original_tweets)
if originalEntity.get("id") != duplicated_entity("id"):
array2.append(second)
Run Code Online (Sandbox Code Playgroud)
Chr*_*tts 13
只要你自然地对光标对象进行迭代,我就不会看到你想要使用range和迭代它.next().
cursor1= Collection.find({x : {"$gt" : 1}})
for record in cursor1:
# do stuff with your record
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27090 次 |
| 最近记录: |