compiler库的简介
根据文件名自动编译运行程序,基于文件类型平台自动编译代码:: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Intended Audience :: Developers Classifier: Natural Language :: English Classifier: License :: OSI Approved :: Apache Software License Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=3
主页:https://github.com/xiaojieluo/vlde
compiler库的安装
pip install compiler
compiler库的使用方法
1、基础用法
使用
from vlde import Validator
v = Validator(return_format='object')
result = v.set_rules('hello', 'required|dict|max_length:3')
if result.status is False:
print('\n'.join(result.error))
或者捕获异常:
from vlde import ValidateError, Validator
v = Validator(return_format='exception')
try:
v.set_rules('hello', 'required|dict')
except ValidateError as e:
print(e)