# 电脑销售量字典 counts = {'MBP': 268, 'HP': 125, 'DELL': 201, 'Small_mi': 200, 'Lenovo': 199, ' acer': 99} # 需求:提取上述电脑数量大于等于200的字典数据 count1 = {key: value for key, value in counts.items() if value >= 200} print(count1) # {'MBP': 268, 'DELL': 201, 'Small_mi': 200}
标签:200,推导,value,count1,筛选,MBP,counts,字典 From: https://www.cnblogs.com/sangern/p/17412501.html