Python(39)_选出列表中的大于66的数字放在字典中
生活随笔
收集整理的這篇文章主要介紹了
Python(39)_选出列表中的大于66的数字放在字典中
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
#-*-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:continueif 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)
?
轉(zhuǎn)載于:https://www.cnblogs.com/sunnybowen/p/10209550.html
總結(jié)
以上是生活随笔為你收集整理的Python(39)_选出列表中的大于66的数字放在字典中的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 缤智为什么这么贵?
- 下一篇: 金杯大海狮车身控制模块在哪里?