当前位置:网站首页>enumrate的start属性的坑
enumrate的start属性的坑
2022-07-02 07:44:00 【lanmy_dl】
enumrate的start属性
是这样的,要两个for循环遍历,取出数据,并且第二个for循环可以在第一个之后取节省处理了的时间,我用了enumerate,结果以为start属性和我想的不一样start属性说明
for index1,((xx1, yy1), rr1, grbb1) in enumerate(center): # 从第一个点开始
for index2,((xx2, yy2), rr2, grbb2) in enumerate(center,start=index1+1):
###code
即使下标变成1,还是和第0个相同
原来只是改变开始值的下标,还是从头给你遍历,这样下标虽然记录的变了,但是数据还是从头取。。。
还是老实用for循环把,突然懂了一般训练代码里面有时候用两个for循环
for index1 in range(len(center)):
(xx1, yy1), rr1, grbb1 = center[index1]
for index2 in range(index+1,len(center)):
(xx2, yy2), rr2, grbb2) = center[index2]
###code
边栏推荐
猜你喜欢

Flink two Open, implement Batch Lookup join (attached source)

【AppLinking实战案例】通过AppLinking分享应用内图片

Use Huawei performance management service to configure the sampling rate on demand

Special topic of binary tree -- acwing 19 The next node of the binary tree (find the successor of the node in the tree)

使用华为性能管理服务,按需配置采样率

Special topic of binary tree -- acwing 3384 Binary tree traversal (known preorder traversal, while building a tree, while outputting middle order traversal)

Creation and use of unified links in Huawei applinking

Hdu1236 ranking (structure Sorting)

Why does LabVIEW lose precision in floating point numbers

I STM32 development environment, keil5/mdk5.14 installation tutorial (with download link)
随机推荐
Is bond fund safe? Does the bond buying foundation lose principal?
如何用list组件实现tabbar标题栏
PHP tea sales and shopping online store
函数式接口和方法引用
How to use ide to automatically sign and debug Hongmeng application
TIPC messaging3
What are the software product management systems? Inventory of 12 best product management tools
Special topic of binary tree -- acwing 3384 Binary tree traversal (known preorder traversal, while building a tree, while outputting middle order traversal)
MongoDB 学习整理(条件操作符,$type 操作符,limit()方法,skip() 方法 和 sort() 方法)
LabVIEW为什么浮点数会丢失精度
Luogu p4281 [ahoi2008] emergency gathering / gathering (tree doubling LCA)
Openmldb meetup No.4 meeting minutes
Special topic of binary tree -- Logu p1229 traversal problem (the number of traversals in the middle order is calculated when the pre and post order traversals of the multiplication principle are know
学习open62541 --- [66] UA_String的生成方法
TIPC介绍1
AppGallery Connect场景化开发实战—图片存储分享
二叉树专题--洛谷 P1229 遍历问题(乘法原理 已知前、后序遍历求中序遍历个数)
二叉树专题--洛谷 P3884 [JLOI2009]二叉树问题(dfs求二叉树深度 bfs求二叉树宽度 dijkstra求最短路)
Indexer in C #
洛谷 P5536 【XR-3】核心城市(贪心 + 树形 dp 寻找树的中心)