“2021年11月”存档文章有34

Python 创建文件夹

主要涉及到三个函数:1、os.path.exists(path): 判断一个目录是否存在2、os.makedirs(path) :多层创建目录3、os.mkdir(path) :创建目录下面是示例代码:import os path=path.strip() #去除首位空格 path=path.rstrip("\\") # 去除尾部 \ 符号 isExists=os.path.exists...

SQLAlchemy 更新数据

下面是几种 SQLAlchemy 更新数据的方式:conn = engine.connect()update_ip_v4_range = (update(IPV4PublicAddress).where(IPV4PublicAddress.ip >= get_from_int) .where(IPV4PublicAddress.ip <= get_to_int) .values( ...

MySQL 数据库连接池与 Redis 缓存问题

最近使用 MySQL 连接池将数据库需要缓存的数据保存到 Redis,使用的是 Python 中的 DBUtils,但是再程序怕了一段时间之后,一直缓存的是原来的数据,并不是最新数据,例如:现在已经过去了几个小时,但是缓存的依然是程序第一次运行的时间,以后都是读取数据库连接池的缓存数据。存在问题的原因:class GETSqlDataUtil(object): def __init__(se...

我们家小崽子涂鸦(5)

我们家小崽子涂鸦(4)

我们家小崽子涂鸦(3)

我们家小崽子涂鸦(2)

我们家小崽子涂鸦(1)