![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python CookBook
weiwei200
这个作者很懒,什么都没留下…
展开
-
解压赋值
一、解压赋值可以用在任何可迭代对象上1.字符串解压>>> str_="jiemo">>> a_,b_,c_,d_,e_=str_>>> a_'j'>>> b_'i'>>> c_'e'>>> d_'m'&原创 2018-11-29 19:56:32 · 431 阅读 · 0 评论 -
查找字典中字段最大值
import heapqdef run(): # l1=[1,4,6,8,2,1,8,-1,-99] # print heapq.nlargest(1,l1),heapq.nsmallest(2,l1) l2=[ {"name":"pchy","num":2}, {"name": "achy", "num": 2},原创 2018-12-13 18:44:08 · 1939 阅读 · 0 评论 -
获取字典中最小值
def run(): prices = {'ACME': 45.23, 'AAPL': 612.78, 'IBM': 205.55, 'HPQ': 37.20, 'FB': 10.75 } print min(prices, key =la...原创 2018-12-14 14:36:12 · 2434 阅读 · 0 评论