01 2022 档案

摘要:1、指定路径、log文件名字 import serial import time import os #对文件、文件夹的操作需要涉及到os模块 DEBUG_LOG = "" TIME = "" TIME = time.strftime("%Y-%m-%d_%H_%M_%S", time.localt 阅读全文
posted @ 2022-01-25 20:51 小鱼小鱼hi 阅读(184) 评论(0) 推荐(0) 编辑
摘要:python 实现创建文件夹和创建日志文件的方法_python_脚本之家 (jb51.net) 1、python中对文件、文件夹(文件操作函数)的操作需要涉及到os模块和shutil模块。 得到当前工作目录,即当前Python脚本工作的目录路径: os.getcwd() 返回指定目录下的所有文件和目 阅读全文
posted @ 2022-01-25 20:50 小鱼小鱼hi 阅读(102) 评论(0) 推荐(0) 编辑
摘要:1、时间格式化 import time TIME = time.strftime("%Y-%m-%d_%H_%M_%S", time.localtime()) print(time.localtime()) ''' 打印:time.struct_time(tm_year=2022, tm_mon=1 阅读全文
posted @ 2022-01-25 20:34 小鱼小鱼hi 阅读(394) 评论(0) 推荐(0) 编辑
摘要:#!/usr/bin/env python #-*- coding: utf-8 -* import serial import serial.tools.list_ports plist = list(serial.tools.list_ports.comports()) if len(plist 阅读全文
posted @ 2022-01-25 14:03 小鱼小鱼hi 阅读(1894) 评论(0) 推荐(0) 编辑
摘要:1、列表迭代 import serial # 串口操作的方法和属性 import serial.tools.list_ports #查找串口 comlist = serial.tools.list_ports.comports() #为所有的串口分别生成ListPortInfo object,列表封 阅读全文
posted @ 2022-01-25 13:41 小鱼小鱼hi 阅读(72) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示