标签:item ems value int val key for python filter
# 列表推导式
# 集合推导式
# map filter
a = [1,2,3,4,5,6,7,8]
b = [i**2 for i in a if i >=5]
print(b)
a = {1,2,3,4,5,6,7,8}
b = {i**2 for i in a if i >=6}
print(b)
# 字典
c = {
"喜小乐":18,
"石敢当":16,
"王小友":17
}
d = [key for key,value in c.items()]
print(d)
e = {value:key for key,value in c.items()}
print(e)
f = (key for key,value in c.items())
for x in f:
print(x)
标签:item ems value int val key for python filter
原文地址:https://www.cnblogs.com/1109v/p/9400321.html