随笔分类 - python3学习笔记
记录学习中遇到的重点,难点,偏僻知识点;
摘要:1、读取某个串口的数据;import timeimport serial.tools.list_portsfrom codecs import getincrementaldecoderportx = "COM4" # 设置串口号bps = 115200 # 设置波特率timex = 5 # 设置超
阅读全文
摘要:1、普通时间 转换为 Unix时间戳; 使用time、datetime库; import timefrom datetime import datetimetime_str = "2020/7/1 4:11:05" # 普通时间time_strp = datetime.strptime(time_s
阅读全文
摘要:1、简单使用方法; import threading def sing(name): for i in list(range(3)): print("{} 正在唱歌 ".format(name)) time.sleep(1)def dance(name): for i in list(range(3
阅读全文
摘要:1、安装模块; pip install xlrd # xlrd模块既可以处理2003版本之前的excel表格 xls,也可以处理新版本表格 xlsx; 但是 只能读取数; pip install openpyxl # openpyxl可以读,可以写,但是不支持老版本的excel文档; 2、表单处理
阅读全文
摘要:1、建议软件目录结构; 目录组织方式 Foo/ |-- bin/ | |-- foo | |-- foo/ | |-- tests/ | | |-- __init__.py | | |-- test_main.py | | | |-- __init__.py | |-- main.py | |--
阅读全文
摘要:必读:json和pickle 可以多次jumps, 1、json适合处理简单数据,可以跨语言、跨文件; 基本方法:(比较low的方法序列化用str转换,反序列化用eval;) import json #数据序列化 info = {"name":"bokeyuan"} f = open("test.t
阅读全文
浙公网安备 33010602011771号