Used to store variables permanently, which can be read directly after importing into the library.
Project description
Permanent Variable Tool
中文文档请往下查看
pvt.new(variable:str, value:Any=None) -> None
Functionality
Creates/updates variable files in ./data/ directory
Usage Example
pvt.new("user_profile", {"name": "John", "age": 28}) # Serializes to string
pvt.new("system_flag") # Creates empty file
pvt.read(variable:str) -> str
Critical Notes
- Always wrap in try-except:
try:
config = pvt.read("app_config")
except FileNotFoundError:
initialize_defaults()
pvt.delete(variable:str) -> None
Security Notice
- Deletion is permanent. Recommended safety check:
if os.path.exists(pvt.data_dir + "/" + variable + ".var"):
pvt.delete("temp_data")
pvt.find (variable name: str) -> Bool
Use examples
Bool = pvt.find(str)
print(Bool) # True / False
pvt.list() -> dict
Functionality
Reads all .var files from C:\pvt_data and converts contents to Python values
Value Mapping Rules
$value.false→False$value.true→True$value.ellipsis→...- Other content remains as string
Usage Example
variables = pvt.list() # Returns {'debug': True, 'max_retries': '5'}
永久变量工具 (Permanent Variable Tool)
Please check the English documents up.
pvt.new(变量名:str, 值:Any=None) -> None
功能
在./data/目录中创建/更新变量文件
使用示例
pvt.new("user_profile", {"name": "张三", "age": 28}) # 序列化为字符串
pvt.new("system_flag") # 创建空文件
pvt.read(变量名:str) -> str
重要说明
- 必须使用try-except包裹:
try:
config = pvt.read("app_config")
except FileNotFoundError:
initialize_defaults()
pvt.delete(变量名:str) -> None
安全提示
- 删除操作不可逆。建议进行安全检查:
if os.path.exists(pvt.data_dir + "/" + variable + ".var"):
pvt.delete("temp_data")
pvt.find(变量名:str) -> Bool
使用示例
Bool = pvt.find(str)
print(Bool) # True / False
pvt.list() -> dict
功能
从C:\pvt_data读取所有.var文件并转换内容为Python值
值转换规则
$value.false→ 布尔值False$value.true→ 布尔值True$value.ellipsis→ 省略号对象...- 其他内容保留原始字符串格式
使用示例
variables = pvt.list() # 返回如 {'debug': True, 'max_retries': '5'}
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.4.tar.gz.
File metadata
- Download URL: permanent_variable_tool-1.0.4.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b69b8ce60ac39bc2951ecf28159d8cb8858ad939c59c5277127c76f2180691d
|
|
| MD5 |
2c25ca33659ec17170747b261f294531
|
|
| BLAKE2b-256 |
15bacd15a8d58e317b5c6cb608ac2756b5e1085ab74b109ee51032f0bacf9a3f
|
File details
Details for the file permanent_variable_tool-1.0.4-py3-none-any.whl.
File metadata
- Download URL: permanent_variable_tool-1.0.4-py3-none-any.whl
- Upload date:
- Size: 8.3 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 |
1ca31d415dda28c83202f801ce03619cdc9a5483d4ed31982a5919fc16116b6b
|
|
| MD5 |
61f892a76f98c3be257984d2a3e8cd38
|
|
| BLAKE2b-256 |
b8c1d384ec79b03e8b6b40a0eb2f2dbb201c2984f1ae123ea444d47d64d44b7c
|