【python 3.6】笨办法取出列表中的字典的value
#python 3.6
#!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'BH8ANK' x = {'RegionSet': [{'Region': 'ap-beijing',
'RegionName': '\xe5\x8d\x8e\xe5\x8c\x97\xe5\x9c\xb0\xe5\x8c\xba(\xe5\x8c\x97\xe4\xba\xac)',
'RegionState': 'AVAILABLE'},
{'Region': 'ap-chengdu',
'RegionName': '\xe8\xa5\xbf\xe5\x8d\x97\xe5\x9c\xb0\xe5\x8c\xba(\xe6\x88\x90\xe9\x83\xbd)',
'RegionState': 'AVAILABLE'},
{'Region': 'ap-chongqing',
'RegionName': '\xe8\xa5\xbf\xe5\x8d\x97\xe5\x9c\xb0\xe5\x8c\xba(\xe9\x87\x8d\xe5\xba\x86)',
'RegionState': 'AVAILABLE'},
{'Region': 'ap-guangzhou',
'RegionName': '\xe5\x8d\x8e\xe5\x8d\x97\xe5\x9c\xb0\xe5\x8c\xba(\xe5\xb9\xbf\xe5\xb7\x9e)',
'RegionState': 'AVAILABLE'},
{'Region': 'ap-guangzhou-open',
'RegionName': '\xe5\x8d\x8e\xe5\x8d\x97\xe5\x9c\xb0\xe5\x8c\xba(\xe5\xb9\xbf\xe5\xb7\x9eOpen)',
'RegionState': 'AVAILABLE'},
{'Region': 'ap-hongkong',
'RegionName': '\xe4\xb8\x9c\xe5\x8d\x97\xe4\xba\x9a\xe5\x9c\xb0\xe5\x8c\xba(\xe9\xa6\x99\xe6\xb8\xaf)',
'RegionState': 'AVAILABLE'},
{'Region': 'ap-mumbai',
'RegionName': '\xe4\xba\x9a\xe5\xa4\xaa\xe5\x9c\xb0\xe5\x8c\xba(\xe5\xad\x9f\xe4\xb9\xb0)',
'RegionState': 'AVAILABLE'},
{'Region': 'ap-seoul',
'RegionName': '\xe4\xb8\x9c\xe5\x8d\x97\xe4\xba\x9a\xe5\x9c\xb0\xe5\x8c\xba(\xe9\xa6\x96\xe5\xb0\x94)',
'RegionState': 'AVAILABLE'},
{'Region': 'ap-shanghai',
'RegionName': '\xe5\x8d\x8e\xe4\xb8\x9c\xe5\x9c\xb0\xe5\x8c\xba(\xe4\xb8\x8a\xe6\xb5\xb7)',
'RegionState': 'AVAILABLE'},
{'Region': 'ap-shanghai-fsi',
'RegionName': '\xe5\x8d\x8e\xe4\xb8\x9c\xe5\x9c\xb0\xe5\x8c\xba(\xe4\xb8\x8a\xe6\xb5\xb7\xe9\x87\x91\xe8\x9e\x8d)',
'RegionState': 'AVAILABLE'},
{'Region': 'ap-shenzhen-fsi',
'RegionName': '\xe5\x8d\x8e\xe5\x8d\x97\xe5\x9c\xb0\xe5\x8c\xba(\xe6\xb7\xb1\xe5\x9c\xb3\xe9\x87\x91\xe8\x9e\x8d)',
'RegionState': 'AVAILABLE'},
{'Region': 'ap-singapore',
'RegionName': '\xe4\xb8\x9c\xe5\x8d\x97\xe4\xba\x9a\xe5\x9c\xb0\xe5\x8c\xba(\xe6\x96\xb0\xe5\x8a\xa0\xe5\x9d\xa1)',
'RegionState': 'AVAILABLE'},
{'Region': 'eu-frankfurt',
'RegionName': '\xe6\xac\xa7\xe6\xb4\xb2\xe5\x9c\xb0\xe5\x8c\xba(\xe5\xbe\xb7\xe5\x9b\xbd)',
'RegionState': 'AVAILABLE'},
{'Region': 'na-ashburn',
'RegionName': '\xe7\xbe\x8e\xe5\x9b\xbd\xe4\xb8\x9c\xe9\x83\xa8(\xe5\xbc\x97\xe5\x90\x89\xe5\xb0\xbc\xe4\xba\x9a)',
'RegionState': 'AVAILABLE'},
{'Region': 'na-siliconvalley',
'RegionName': '\xe7\xbe\x8e\xe5\x9b\xbd\xe8\xa5\xbf\xe9\x83\xa8(\xe7\xa1\x85\xe8\xb0\xb7)',
'RegionState': 'AVAILABLE'},
{'Region': 'na-toronto',
'RegionName': '\xe5\x8c\x97\xe7\xbe\x8e\xe5\x9c\xb0\xe5\x8c\xba(\xe5\xa4\x9a\xe4\xbc\xa6\xe5\xa4\x9a)',
'RegionState': 'AVAILABLE'}],
'RequestId': 'CDFBE924-36FE-30AE-1B46-5AFCDF8A943D',
'TotalCount': 16} y_list = x['RegionSet']
#y_list是一个list,其中每个元素包含地域信息,每个元素又是单独的一个dict
print(y_list)
i = 0
c_list = []
for i in range(len(y_list)): b_dict = y_list[i]
c_list.append(b_dict['Region'])
# print(a['Region'])
print(b_dict)
print(c_list)
【python 3.6】笨办法取出列表中的字典的value的更多相关文章
- python中字典排序,列表中的字典排序
python中字典排序,列表中的字典排序 一.使用python模块:operator import operator #首先要导入模块operator x = {1:2, 3:4, 4:3, 2:1, ...
- Python列表中的字典按照该字典下的键值进行排序
列表中的字典按照该字典下的键值进行排序 这算是排序中比较复杂的一种情况吧,多重嵌套,按照某种规则进行排序.如下面这个json(注:这里这是该列表中的一个项): [ { "stat" ...
- python:找出两个列表中相同和不同的元素(使用推导式)
#接口返回值 list1 = ['张三', '李四', '王五', '老二'] #数据库返回值 list2 = ['张三', '李四', '老二', '王七'] a = [x for x in lis ...
- python实践项目三:将列表添加到字典
1.创建一个字典,其中键是字符串,描述一个物品,值是一个整型值,说明有多少该物品.例如,字典值{'rope': 1, 'torch': 6, 'gold coin': 42, 'dagger': 1, ...
- Python生成器、三元表达式、列表生成式、字典生成式、生成器表达式
什么是生成器:只要函数内部包含有yield关键字,那么函数名()的到的结果(生成器地址)就是生成器,再调用函数不会执行函数内部代码这个生成器本身有 _iter_ he _next_功能(即生成器 ...
- 取出列表中第N大的数
array=list(range(10)) random.shuffle(array) print(array) def func1(array,n): d,k={},n while k>0: ...
- Python 练习题:用索引取出LIST中的值
请用索引取出下面list的指定元素,分别为Apple,Python,Lisa # -*- coding: utf-8 -*- # 请用索引取出下面list的指定元素 L = [ ['Apple','G ...
- python之使用heapq()函数计算列表中数值大小
# heapq函数:计算列表最大几个值和最小几个值 # 语法:heapq.nlargest(n, list,[key]) # n表示最大或最小的几个: list为分析的对象: key为排序关键字,非必 ...
- Python3基础 list pop(含参) 取出列表中的指定索引的元素
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
随机推荐
- Xcode12 libstdc-.6.0.9.tbd问题
https://github.com/Kila2/libstdc-.6.0.9.tbd # libstdc-.6.0.9.tbd libstdc++.6.0.9.tbd # for device pu ...
- SQL语句group by 与order by 执行顺序引发的一场“内斗”
直入主题!看看下面这SQL会不会报错?如果报错应该是什么错误! --说明:黑色字体都是列SELECT application_id, index_num, num, amount FROM `cred ...
- ueditor getshell漏洞重现及分析
0x00 概述 8月21日,网上爆出ueditor .net版本getshell漏洞,由于只校验ContentType而没校验文件后缀导致getshell. 0x01 漏洞重现 Payload: &l ...
- sizeof 用于返回一个对象或者类型所占据的内存数
整数类型 sizeof(int); 4字节or8字节 函数 sizeof(函数); 函数返回值类型占据的字节数 字符数组 char c[] = "abc"; sizeof(c); ...
- #leetcode刷题之路16-最接近的三数之和
给定一个包括 n 个整数的数组 nums 和 一个目标值 target.找出 nums 中的三个整数,使得它们的和与 target 最接近.返回这三个数的和.假定每组输入只存在唯一答案. 例如,给定数 ...
- node 借助Node Binary管理模块“n”更新
Node.js的版本频繁变化,如果有模块不能在你当前的Node版本上使用,需要升级Node环境 1)首先:查看当前node版本:node –v 2)安装n模块:npm install -g n 3)检 ...
- 构建WebGL目标时的内存考量
Memory Considerations when targeting WebGL 构建WebGL目标时的内存考量 Memory in Unity WebGL can be a constraini ...
- redis学习笔记(三)
Spring data redis: 要求: Redis 版本 > 2.6 与 Lettuce 或 Jedis 集成,两种java开源Redis库. Spring redis主要做的两件事: 连 ...
- HCNA(一)网络传输介质
一 .同轴线缆 介绍:同轴线缆是一种早期的网络传输介质,同轴电缆的得名与它的结构相关,由内导体.外导体.绝缘介质和防护套四部分组成.同样支持10Mbps传输速率.现在已经基本被淘汰,不在应用于企业网络 ...
- Leecode刷题之旅-C语言/python-387 字符串中的第一个唯一字符
/* * @lc app=leetcode.cn id=387 lang=c * * [387] 字符串中的第一个唯一字符 * * https://leetcode-cn.com/problems/f ...