码迷,mamicode.com
首页 > 其他好文 > 详细

列表推导式和字典推导式

时间:2019-02-03 12:16:39      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:lag   list   字典   mem   member   uid   color   http   col   

列表推导式
 urllist = ["http://www.zhuangxiule.cn/c{}p{}/".format(i,x) for i in range(16,26) for x in range(0,25)]
 print(urllist)

字典推导式

cookie = sts=0; UM_distinctid=16797c557a946-0f8967c2c5550c-4947311e-100200-16797c557aa5f8; Hm_lvt_9bb494db4665e40147cd57b89d6628e2=1544439553; remember=1; name_ie=%25113%25117%2597%25110%25115%25104%25117%25111%25103%25117%25111; I=i%3D3475276%26u%3D4040051%26n%3Dquanshuoguo%26m%3D0%26t%3D1544658451.1589200%26s%3Df041303d8e24b17642821e0ff5ef3579%26v%3D1.1; Hm_lvt_6ab7a391c8d69b4f62b7c54b2d70919c=1544767110,1544767165,1544767909,1544767975; site_str_flag=3; lc=57091; lc2=57091; wc=57091; wc_n=%25u5F00%25u5C01; bdUid=C83B6815683EEF2C20B73C89AD4A
cookie_list = {i.split("=")[0]:i.split("=")[-1] for i in cookie.split("; ")}
print(cookie_list)

 

 

列表推导式和字典推导式

标签:lag   list   字典   mem   member   uid   color   http   col   

原文地址:https://www.cnblogs.com/xcsg/p/10350044.html

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