![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
铽可喏
专注于C/C++开发的程序员
展开
-
Excel的读写
openpyxl模块是一个读写Excel 2010文档的Python库,如果要处理更早格式的Excel文档,需要用到额外的库,openpyxl是一个比较综合的工具,能够同时读取和修改Excel文档。其他很多的与Excel相关的项目基本只支持读或者写Excel一种功能。安装openpyxl模块 pip install openpyxl 2. 源码开发...原创 2018-11-27 12:11:49 · 161 阅读 · 0 评论 -
WebSocket
什么是Websocket WebSocket 是 HTML5 开始提供的一种在单个 TCP 连接上进行全双工通讯的协议。HTTP 协议是一种无状态的、无连接的、单向的应用层协议。它采用了请求/响应模型。通信请求只能由客户端发起,服务端对请求做出应答处理。HTTP 协议无法实现服务器主动向客户端发起消息,注定了如果服务器有连续的状态变化,客户端要获知就非常麻烦,轮询的效率低,非常浪费资...原创 2018-11-27 14:45:25 · 157 阅读 · 0 评论 -
json比较
import jsondef isEqual(standard_dict, target_dict): if not standard_dict or not target_dict: if not standard_dict: print "Not find standard semantic" if not targe...原创 2018-11-27 14:57:10 · 199 阅读 · 0 评论 -
sha1加密
sha1加密需要使用haslib,最终可返回40字节的加密结果,具体代码如下:import hashlibsig = hashlib.sha1(txt).hexdigest()print("sig = {},len = {}".format(sig,len(sig))) ...原创 2018-11-27 15:00:45 · 410 阅读 · 0 评论 -
get请求
使用requests库,可以很方便地实现get、post等http请求。代码示例如下:import requestsurl = "http://xxxxxxxxxxxxx"res = requests.get(url)print("res = {}".format(res.text)) ...原创 2018-11-27 15:13:23 · 224 阅读 · 0 评论 -
Python获取json中key值为中文的value
# -*- coding:UTF-8 -*-import jsondef getPinyinFromLocal(in_hanzi): with open("result.txt",'r') as file_name: js_localpinyin = json.load(file_name,"utf-8") pinyin = js_localpinyin.get(in_hanz...原创 2019-03-22 11:57:01 · 6176 阅读 · 0 评论