![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
hongtao1126
这个作者很懒,什么都没留下…
展开
-
python3 将时间补齐。比较时间戳
直接来代码nowTime = datetime.now()timeStr = '20:00:00 010'strVal = nowTime.strftime("%Y-%m-%d")cfgTime = datetime.strptime(strVal + ' ' + timeStr, '%Y-%m-%d %H:%M:%S %f')print(f' { cfgTime.timestamp()} {nowTime.timestamp()}')也可以用于修改时间戳的 日期 月份,得到新的时间戳原创 2021-02-06 18:42:23 · 825 阅读 · 0 评论 -
Python3 去掉json中带的注释
json.loads 不支持带注释的json格式, 把文件内容读取出来删掉注释再加载def parse_json_str(jsonStr: str): pos = 0 bPos = 0 flg = '/' isMathModel = False while (True): pos = jsonStr.find(flg, pos) if pos > -1: if isMathModel: .原创 2021-01-07 14:34:27 · 1491 阅读 · 2 评论