01 2017 档案

摘要:operator.itemgetter函数operator模块提供的itemgetter函数用于获取对象的哪些维的数据,参数为一些序号。看下面的例子 a = [1,2,3] >>> b=operator.itemgetter(1) //定义函数b,获取对象的第1个域的值>>> b(a) 2 >>> 阅读全文
posted @ 2017-01-11 16:24 蜗牛到牛 阅读(63760) 评论(0) 推荐(1)
摘要:1、字典转化为列表 a={"username":"12","password":"89"} print a.items() 运行结果:》》》 [('username', '12'), ('password', '89')] 2、字典转化为字符串 a={"username":"12","passwor 阅读全文
posted @ 2017-01-06 15:06 蜗牛到牛 阅读(308) 评论(0) 推荐(0)