Used to store variables permanently, which can be read directly after importing into the library.
Project description
Permanent Variable Tool
中文文档请往下查看
var.new(variable:str, value:Any=None) -> None
Functionality
Creates/updates variable files in ./data/ directory
Usage Example
var.new("user_profile", {"name": "John", "age": 28}) # Serializes to string
var.new("system_flag") # Creates empty file
var.read(variable:str) -> str
Critical Notes
- Always wrap in try-except:
try:
config = var.read("app_config")
except FileNotFoundError:
initialize_defaults()
var.delete(variable:str) -> None
Security Notice
- Deletion is permanent. Recommended safety check:
if os.path.exists(var.data_dir + "/" + variable + ".var"):
var.delete("temp_data")
永久变量工具 (Permanent Variable Tool)
Please check the English documents up.
var.new(变量名:str, 值:Any=None) -> None
功能
在./data/目录中创建/更新变量文件
使用示例
var.new("user_profile", {"name": "张三", "age": 28}) # 序列化为字符串
var.new("system_flag") # 创建空文件
var.read(变量名:str) -> str
重要说明
- 必须使用try-except包裹:
try:
config = var.read("app_config")
except FileNotFoundError:
initialize_defaults()
var.delete(变量名:str) -> None
安全提示
- 删除操作不可逆。建议进行安全检查:
if os.path.exists(var.data_dir + "/" + variable + ".var"):
var.delete("temp_data")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file permanent_variable_tool-1.0.2.tar.gz.
File metadata
- Download URL: permanent_variable_tool-1.0.2.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0871694b5c096f37f618d208c0a8852b57daeaad634e76177fd25c2ccb58a19
|
|
| MD5 |
7960246afa22573d8ec70829fa5d07d1
|
|
| BLAKE2b-256 |
603234842c7fd38d36075029271014f17e9617b8deb46fe9f279ce9e7c213d6c
|
File details
Details for the file permanent_variable_tool-1.0.2-py3-none-any.whl.
File metadata
- Download URL: permanent_variable_tool-1.0.2-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b85c0b6796629d79ce7408b5333fb8214fb21a1e4ab0c3615e0154c35024d61c
|
|
| MD5 |
fcb0194e5b33a4f49eb85d9bba0c1631
|
|
| BLAKE2b-256 |
b590c2b48c9e38bea44b9ad7862c88920c9100ba15e7fae4df72d77ec67c8096
|