import dbm with dbm.open(file="/tmp/cache", flag="c") as db: print(db.keys()) print("=" * 20) if "hello".encode() in db.keys(): print(f"找到: { db['hello']}") else: print(f"没找到") db["hello"] = "world"