摘要: dotnet core c# 大文件 读取 //注册编码提供程序 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); //实例 using var sr = new System.IO.StreamReader(@"E:\Au 阅读全文
posted @ 2021-05-11 11:32 忆秋年枫叶情 阅读(225) 评论(0) 推荐(0)
摘要: 时间同步 校准 官方同步库 ntptime def sync_ntp(): """通过网络校准时间""" import ntptime ntptime.NTP_DELTA = 3155644800 # 可选 UTC+8偏移时间(秒),不设置就是UTC0 ntptime.host = 'ntp1.al 阅读全文
posted @ 2021-05-11 09:55 忆秋年枫叶情 阅读(4565) 评论(0) 推荐(0)
摘要: utime 本地时间 import utime utime.localtime() 时间戳(秒) 时间戳是以模块rtc时钟初始值以起点计算的秒数 如esp32模块的rtc初始时钟是 2000年1月1日 import utime utime.mktime(utime.localtime()) #esp 阅读全文
posted @ 2021-05-10 21:01 忆秋年枫叶情 阅读(2177) 评论(0) 推荐(0)
摘要: JSON 1. 对象 → 字符串 import ujson jsonObj = {"a": "1", "b": "2"} jsonStr = ujson.dumps(jsonObj) 2. 字符串 → 对象 import json jsonStr = '{"a": "1", "b": "2"}' j 阅读全文
posted @ 2021-05-10 20:44 忆秋年枫叶情 阅读(468) 评论(0) 推荐(0)
摘要: SHA256 SHA256-SHA2系列的最新现代哈希算法。它适用于加密安全的目的。 import uhashlib import ubinascii ## 常规 text = b'123' # 需要加密的数据 或 "123".decode("utf8") hash = uhashlib.sha25 阅读全文
posted @ 2021-05-10 20:35 忆秋年枫叶情 阅读(519) 评论(0) 推荐(0)
摘要: 完整示例 (控制台) using System; using System.Collections.Generic; using System.Diagnostics; using System.Net.Http; using System.Threading; using System.Threa 阅读全文
posted @ 2021-05-09 11:34 忆秋年枫叶情 阅读(150) 评论(0) 推荐(0)
摘要: 示例 try: pass except (Exception, OverflowError, AttributeError): #捕获多个异常 print("发生了异常执行") pass else: print("没发生异执行") pass finally: print("finally") pas 阅读全文
posted @ 2021-05-09 11:33 忆秋年枫叶情 阅读(83) 评论(0) 推荐(0)
摘要: import time # 当地时间 time.localtime() # (tm_year=2021, tm_mon=5, tm_mday=3, tm_hour=19, tm_min=50, tm_sec=40, tm_wday=0, tm_yday=123, tm_isdst=0) time.s 阅读全文
posted @ 2021-05-09 11:30 忆秋年枫叶情 阅读(752) 评论(0) 推荐(0)
摘要: 文档: https://www.pycryptodome.org/en/latest/ # pip install pycryptodome from Crypto.Cipher import AES import base64 class Encrypt: def __init__(self, k 阅读全文
posted @ 2021-05-09 11:29 忆秋年枫叶情 阅读(562) 评论(0) 推荐(0)
摘要: import asyncio import time async def say_after(delay, what): """使用 async 声明函数""" await asyncio.sleep(delay) print(what) async def main(): # 一个一个执行 pri 阅读全文
posted @ 2021-05-09 11:27 忆秋年枫叶情 阅读(61) 评论(0) 推荐(0)