码迷,mamicode.com
首页 > 编程语言 > 详细

Python(39)_选出列表中的大于66的数字放在字典中

时间:2019-01-02 19:14:09      阅读:245      评论:0      收藏:0      [点我收藏+]

标签:coding   class   code   src   python   img   div   span   inf   

#-*-coding:utf-8-*-
‘‘‘

‘‘‘
li = [11,22,33,44,55,66,77,88,99]
dic = {}
l_greater = []
l_smaller = []
for i in li:
    if i ==66:
        continue
    if i>66:
        l_greater.append(i)
    else:
        l_smaller.append(i)
print(l_greater)
print(l_smaller)
# 放到字典里
dic.setdefault(k1,l_smaller)
dic.setdefault(k2,l_greater)
print(dic)

技术分享图片

 

Python(39)_选出列表中的大于66的数字放在字典中

标签:coding   class   code   src   python   img   div   span   inf   

原文地址:https://www.cnblogs.com/sunnybowen/p/10209550.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!