当前位置:网站首页>zip 和.items()区别
zip 和.items()区别
2022-06-12 06:03:00 【换个名字就很好】
zip 是重排列了变量的指针,从zip取出来的东西做修改会在原来的变量中生效。
.item() 取出来的是值,从.items()取出来的东西做修改不会影响原来的变量分毫。
import json
pth = r"F:\vscode_files\project\segment_side\segment_side_example-18.json"
f = open(pth)
dict_img_id_seg = {}
seg_json = json.load(f)
anno = seg_json["annotations"][0]
dict_img_id_seg[anno["image_id"]] = [anno["category_id"], anno["segmentation"]]
print(dict_img_id_seg)
for k, v in dict_img_id_seg.items():
print(type(k))
print(type(v))
v = 1
print(type(dict_img_id_seg.items()))
print(dict_img_id_seg)
list1 = [dict_img_id_seg]
list2 = [1]
for one, two in zip(list1, list2):
print(type(one))
print(type(two))
one[2400] = two
two = 2
print(type(zip(list1, list2)))
print(list1)
print(list2)
output:
{2400: [11, [[144.7, 134.2, 185.5, 132.3, 183.9, 149.6, 142.1, 150.0, 141.7, 143.0, 144.7, 137.3]]]}
<class 'int'>
<class 'list'>
<class 'dict_items'>
{2400: [11, [[144.7, 134.2, 185.5, 132.3, 183.9, 149.6, 142.1, 150.0, 141.7, 143.0, 144.7, 137.3]]]}
<class 'dict'>
<class 'int'>
<class 'zip'>
[{2400: 1}]
[1]
边栏推荐
- IO to IO multiplexing from traditional network
- [PowerShell] command line output and adding system environment variables
- Leetcode 第 80 場雙周賽題解
- Introduction to redis high availability
- Liunx Foundation
- Lock and reentrankload
- [C language basics] macro definition usage
- Leetcode-2048. Next larger numerical balance
- BRDF of directx11 advanced tutorial PBR (2)
- Leetcode-1260. 2D mesh migration
猜你喜欢

Front desk display LED number (number type on calculator)

Houdini terrain creation

Individual application for ov type SSL certificate
![[PowerShell] command line output and adding system environment variables](/img/49/b92175181aa4a3fddfa3adcacf1d72.jpg)
[PowerShell] command line output and adding system environment variables

Idea common configuration

Introduction to redis high availability

姿态估计之2D人体姿态估计 - PifPaf:Composite Fields for Human Pose Estimation

User login 【 I 】

Heap classical problem

Leetcode simple problem: converting an integer to the sum of two zero free integers
随机推荐
Why don't databases use hash tables?
Tabulation skills and matrix processing skills
BRDF of directx11 advanced tutorial PBR (2)
Login authentication filter
Unity vscode cannot jump to definition
Chapter 7 - pointer learning
C WMI query remote Win32_ Operatingsystem class
EBook editing and deleting
Memory model, reference and function supplement of program
Niuke daily question -day1
Performance optimization metrics and tools
IBL of directx11 advanced tutorial PBR (3)
Une explication du 80e match bihebdomadaire de leetcode
Available RTMP and RTSP test addresses of the public network (updated in March, 2021)
Error the main class com xxx. yyy. Application
Leetcode-646. Longest number pair chain
项目开发流程简单介绍
Un mois de DDD hépatique.
Directx11 advanced tutorial PBR (1) summary of physical phenomena of light
Leetcode simple problem: converting an integer to the sum of two zero free integers