python
hello php
这个作者很懒,什么都没留下…
展开
-
Python——列表中存放字典遇到的问题
python中,将字典添加进列表(append),字典改变后列表也跟着改变的问题# 递归遍历获取字典数据def inner(dic): for key, value in dic.items(): # 如果是字典类型的话就继续遍历 if isinstance(value, dict): inner(value) else: # 如果是数组的话,说明是有多条数据,也要继续遍历该数据原创 2020-12-30 14:36:46 · 439 阅读 · 0 评论 -
python 文件上传之---断点续传
server.py文件内容如下import socketimport osimport jsonimport hashlibsk = socket.socket()sk.bind(('127.0.0.1', 8000))sk.listen(5)conn, addr = sk.accept()while True: # 接受客户端发送的数据,看是否存在存在md5文件...原创 2019-11-22 13:37:13 · 1614 阅读 · 0 评论 -
python3 内置函数
"""# 内置函数之---abs():绝对值# a = 10086a = 'hello'try: print(abs(a)) with open('666.p', 'r', encoding='utf-8') as f: print(f.read())except TypeError: print('Error: 数据类型错误')except ...原创 2019-10-23 11:02:17 · 429 阅读 · 0 评论 -
分享一段python的生成器的的案例(协程)
import time# python生成器的例子(协程)def consumer(): r = '' while True: n = yield r if not n: return print('[消费者] Consuming %s...' % n) time.sleep(1) ...转载 2019-04-10 10:19:51 · 132 阅读 · 0 评论