您的位置:首页 > 编程语言 > Python开发

Python之compiler:compiler库的简介、安装、使用方法之详细攻略

2020-09-04 21:57 1751 查看

Python之compiler:compiler库的简介、安装、使用方法之详细攻略

 

 

 

目录

compiler库的简介

compiler库的安装

compiler库的使用方法

 

 

 

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、基础用法

[code]使用
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)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: