其它通用方法
其它通用方法汇总
API说明
getMd5
sunday.utils.getMd5
(value)文本生成md5值 Args: value(str): 文本字符串
currentTimestamp
sunday.utils.currentTimestamp
()返回当前时间戳, 单位为毫秒
parseJsonp
sunday.utils.parseJsonp
(text, defvalue={})解析jsonp数据返回dict数据
Args:
text(str): jsonp数据字符串, 格式如:jsonp_12345({})
parseJson
sunday.core.parseJson
(jsonPath, defaultValue={}, keywords=[], logger=None)传入json文件,返回解析后的json数据 Args: jsonPath(str): 文件路径 defaultValue(list | dict): 文件读取失败时返回的默认数据 keywords(list): 需要的键集合 logger(Logger): 日志对象
clear
sunday.core.clear
()清空屏幕
exit
sunday.core.exit
(text='')退出程序 Args: text(str): 程序退出并打印退出提示文本
pascal_to_snake
sunday.core.pascal_to_snake
(text)驼峰转蛇形
Usages:
>>> from sunday.core.common import pascal_to_snake
>>> pascal_to_snake('HelloWorld')
hello_world
Args:
text(str): 驼峰串
snake_to_pascal
sunday.core.snake_to_pascal
(text)蛇形转驼峰
Usages:
>>> from sunday.core.common import snake_to_pascal
>>> snake_to_pascal('hello_world')
HelloWorld
Args:
text(str): 蛇形串