当前位置:网站首页>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]
边栏推荐
- Leetcode-717. 1-bit and 2-bit characters (O (1) solution)
- BRDF of directx11 advanced tutorial PBR (2)
- Poisson disk sampling for procedural placement
- 肝了一個月的 DDD,一文帶你掌握
- A month's worth of DDD will help you master it
- 前台展示LED数字(计算器上数字类型)
- Memory model, reference and function supplement of program
- Niuke daily question -day1
- Database experiment I: data definition experiment guide
- Types, functions and applications of intelligent sensors
猜你喜欢

March 4, 2021

RTMP streaming +rtmp playback low delay solution in unity environment

数据库为什么不使用hash表?

The application could not be installed: INSTALL_FAILED_TEST_ONLY

TCP and UDP introduction

Tabulation skills and matrix processing skills

Leetcode-1043. Separate arrays for maximum sum

Redis transaction

Front desk display LED number (number type on calculator)

IBL of directx11 advanced tutorial PBR (3)
随机推荐
How to increase heap size of JVM [duplicate] - how to increase heap size of JVM [duplicate]
[gpio] how to modify / display GPIO status through ADB shell
Jackson - how to convert the array string with only one map object to list < map >
BRDF of directx11 advanced tutorial PBR (2)
Nrf52832 -- official routine ble_ app_ UART adds the LED feature to enable the computer UART and mobile app to control the LED on and off of the development board
Nrf52832 custom services and features
Login authentication filter
Leetcode 第 80 場雙周賽題解
Error the main class com xxx. yyy. Application
Es6-es11 learning
Poisson disk sampling for procedural placement
Leetcode-93. Restore IP address
软件项目架构简单总结
China's elastic belt market trend report, technical dynamic innovation and market forecast
Why is the union index the leftmost matching principle?
Introduction to redis high availability
Database experiment I: data definition experiment guide
R language homework (IV): GDP value analysis of Shanghai and Tokyo from 1997 to 2018
肝了一個月的 DDD,一文帶你掌握
Execute sh script to prompt "[[: not found" solution. The difference between Bash and sh