- 博客(5)
- 收藏
- 关注
原创 Python中高阶函数---sorted,filter,map
sorted sorted(iterable, /, *, key=None, reverse=False) Return a new list containing all items from the iterable in ascending order. A custom key function can be supplied to customize th...
2019-05-17 20:23:30
251
1
原创 Python中的序列化 -- JSON和PICKLE
JSON JSON 支持字典和列表两种数据类型的序列化 1.dumps 和 loads dumps 和 loads 序列化对象 >>> import json >>> d = {'a':1,'b':2,'c':3} >>> d_j = json.dumps(d) >>> d_j '{"c": 3, "b": 2, "a": ...
2019-05-17 18:48:41
206
原创 list,set,tuple,dict的简单使用
常用方法 list: append,insert,remove,del,pop tuple:无 set:add,remove dict:pop 新建 list: 1.a = [] ; 2.a = list() tuple: t = tuple() ; t=('a',) set: s = set() ; s = {'a'},注意不可以是s={} dict: 1.d={} ; 2.d = d...
2019-05-14 14:15:06
335
原创 Python中sort和sorted方法的异同
用法: a = sorted(a) sorted(iterable, /, *, key=None, reverse=False) Return a new list containing all items from the iterable in ascending order. a.sort() a.sort(*, key=None, reverse=False) Stab...
2019-05-14 13:29:23
431
原创 Python中list列表的几种拷贝方式
参考地址:Python: copying a list the right way list列表几种拷贝方式: import copy a = [[1,2],10,20] a1 = a #第1种 a2 = a[:] #第2种 a3 = list(a) #第3种 a4 = a*1 #第4种 a5 = copy.copy(a) #第5种 a6 = [x for x in a] #...
2019-05-12 08:52:49
4484
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人