Document

随笔分类 -  Python

摘要:import os import sys def copy_file(srcfile, dstpath): if not os.path.isfile(srcfile): print("{} 文件不存在".format(srcfile), flush=True) sys.exit(1) else: 阅读全文
posted @ 2022-02-25 15:40 lsepi 阅读(60) 评论(0) 推荐(0) 编辑
摘要:def replace_contents(old_content, new_content, file_path): file_data = "" with open(file_path, "r", encoding="UTF-8") as f: for line in f: if old_cont 阅读全文
posted @ 2022-02-25 15:38 lsepi 阅读(73) 评论(0) 推荐(0) 编辑
摘要:import threading mutex_lock = threading.RLock() class Threads(threading.Thread): def __init__(self,name): threading.Thread.__init__(self) def run(self 阅读全文
posted @ 2022-02-25 15:36 lsepi 阅读(248) 评论(0) 推荐(0) 编辑
摘要:重写unittest import unittest class ParametrizedTestCase(unittest.TestCase): """ TestCase classes that want to be parametrized should inherit from this c 阅读全文
posted @ 2022-01-21 15:04 lsepi 阅读(53) 评论(0) 推荐(0) 编辑
摘要:代码编码: python编码 1、国际惯例,文件编码和 Python 编码格式全部为 utf-8 ,例如:在 Python 代码的开头,要统一加上 # -- coding: utf-8 --。 2、Python 代码中,非 ascii 字符的字符串,请需添加u前缀 3、若出现 Python编 码问题 阅读全文
posted @ 2021-06-22 15:53 lsepi 阅读(358) 评论(0) 推荐(0) 编辑

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