2019年4月29日
摘要: '''栈stack 先进后出FILO (first in last out)''' lst = [] lst.append("张一山") lst.append("杨紫") lst.append("周冬雨") ret = lst.pop() print(ret) ret = lst.pop() pri 阅读全文
posted @ 2019-04-29 18:04 lilyxiaoyy 阅读(4109) 评论(0) 推荐(0) 编辑
摘要: from collections import defaultdict '''默认值字典''' d = defaultdict(lambda: 123) print(d) print(type(d)) print('__iter__' in dir(d)) print('__next__' in d 阅读全文
posted @ 2019-04-29 17:26 lilyxiaoyy 阅读(1124) 评论(0) 推荐(0) 编辑
摘要: from collections import Counter c = Counter("周周周周都方法及") print(c) print(type(c)) print('__iter__' in dir(c)) print('__next__' in dir(c)) print('items' 阅读全文
posted @ 2019-04-29 16:57 lilyxiaoyy 阅读(2081) 评论(0) 推荐(0) 编辑
摘要: import json """将python的字典和列表转化为json字符串。json是前后端交互的枢纽""" dic = {'name': '莉莉', 'age':18} str_json = json.dumps(dic, ensure_ascii=False) # 将python中的字典转换为 阅读全文
posted @ 2019-04-29 14:15 lilyxiaoyy 阅读(1314) 评论(0) 推荐(0) 编辑
摘要: import random '''random随机数模块''' # 生成一个0到1的随机小数,不常用 print(random.random()) print(type(random.random())) 0.591104288833299 <class 'float'> import random 阅读全文
posted @ 2019-04-29 14:00 lilyxiaoyy 阅读(487) 评论(1) 推荐(1) 编辑
摘要: import time # strftime获取当前系统格式化时间,%X和%H:%M:%S相等 print(time.strftime("%Y-%m-%d %H:%M:%S")) print(time.strftime("%Y-%m-%d %X")) print(type(time.strftime 阅读全文
posted @ 2019-04-29 11:23 lilyxiaoyy 阅读(255) 评论(0) 推荐(0) 编辑

返回
顶部