| |
- builtins.object
-
- tool
- json.encoder.JSONEncoder(builtins.object)
-
- CJsonEncoder
class CJsonEncoder(json.encoder.JSONEncoder) |
|
CJsonEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)
Extensible JSON <http://json.org> encoder for Python data structures.
Supports the following objects and types by default:
+-------------------+---------------+
| Python | JSON |
+===================+===============+
| dict | object |
+-------------------+---------------+
| list, tuple | array |
+-------------------+---------------+
| str | string |
+-------------------+---------------+
| int, float | number |
+-------------------+---------------+
| True | true |
+-------------------+---------------+
| False | false |
+-------------------+---------------+
| None | null |
+-------------------+---------------+
To extend this to recognize other objects, subclass and implement a
``.default()`` method with another method that returns a serializable
object for ``o`` if possible, otherwise it should call the superclass
implementation (to raise ``TypeError``). |
|
- Method resolution order:
- CJsonEncoder
- json.encoder.JSONEncoder
- builtins.object
Methods defined here:
- default(self, obj)
- Implement this method in a subclass such that it returns
a serializable object for ``o``, or calls the base implementation
(to raise a ``TypeError``).
For example, to support arbitrary iterators, you could
implement default like this::
def default(self, o):
try:
iterable = iter(o)
except TypeError:
pass
else:
return list(iterable)
# Let the base class default method raise the TypeError
return JSONEncoder.default(self, o)
Methods inherited from json.encoder.JSONEncoder:
- __init__(self, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)
- Constructor for JSONEncoder, with sensible defaults.
If skipkeys is false, then it is a TypeError to attempt
encoding of keys that are not str, int, float or None. If
skipkeys is True, such items are simply skipped.
If ensure_ascii is true, the output is guaranteed to be str
objects with all incoming non-ASCII characters escaped. If
ensure_ascii is false, the output can contain non-ASCII characters.
If check_circular is true, then lists, dicts, and custom encoded
objects will be checked for circular references during encoding to
prevent an infinite recursion (which would cause an OverflowError).
Otherwise, no such check takes place.
If allow_nan is true, then NaN, Infinity, and -Infinity will be
encoded as such. This behavior is not JSON specification compliant,
but is consistent with most JavaScript based encoders and decoders.
Otherwise, it will be a ValueError to encode such floats.
If sort_keys is true, then the output of dictionaries will be
sorted by key; this is useful for regression tests to ensure
that JSON serializations can be compared on a day-to-day basis.
If indent is a non-negative integer, then JSON array
elements and object members will be pretty-printed with that
indent level. An indent level of 0 will only insert newlines.
None is the most compact representation.
If specified, separators should be an (item_separator, key_separator)
tuple. The default is (', ', ': ') if *indent* is ``None`` and
(',', ': ') otherwise. To get the most compact JSON representation,
you should specify (',', ':') to eliminate whitespace.
If specified, default is a function that gets called for objects
that can't otherwise be serialized. It should return a JSON encodable
version of the object or raise a ``TypeError``.
- encode(self, o)
- Return a JSON string representation of a Python data structure.
>>> from json.encoder import JSONEncoder
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo": ["bar", "baz"]}'
- iterencode(self, o, _one_shot=False)
- Encode the given object and yield each string
representation as available.
For example::
for chunk in JSONEncoder().iterencode(bigobject):
mysocket.write(chunk)
Data descriptors inherited from json.encoder.JSONEncoder:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from json.encoder.JSONEncoder:
- item_separator = ', '
- key_separator = ': '
|
class tool(builtins.object) |
| |
Methods defined here:
- CodeDemo(self, uname='', pwd='', img='', typeid='', timeout=0, exc=0, angle='', step='', typename='', imageback='', content='', title_image='')
- 参考:http://www.ttshitu.com/docs/index.html#pageTitle
:param uname: 快识别账号
:param pwd: 快识别密码
:param img: 图片地址
:param typeid: 识别类型 # 一、图片文字类型(默认 3 数英混合):
# 1 : 纯数字
# 1001:纯数字2
# 2 : 纯英文
# 1002:纯英文2
# 3 : 数英混合
# 1003:数英混合2
# 4 : 闪动GIF
# 7 : 无感学习(独家)
# 11 : 计算题
# 1005: 快速计算题
# 16 : 汉字
# 32 : 通用文字识别(证件、单据)
# 66: 问答题
# 49 :recaptcha图片识别
# 二、图片旋转角度类型:
# 29 : 旋转类型
#
# 三、图片坐标点选类型:
# 19 : 1个坐标
# 20 : 3个坐标
# 21 : 3 ~ 5个坐标
# 22 : 5 ~ 8个坐标
# 27 : 1 ~ 4个坐标
# 48 : 轨迹类型
#
# 四、缺口识别
# 18 : 缺口识别(需要2张图 一张目标图一张缺口图)
# 33 : 单缺口识别(返回X轴坐标 只需要1张图)
# 五、拼图识别
# 53:拼图识别
:param angle: 旋转角度:当typeid为14时旋转角度 默认90
:param step: 每次旋转的角度:当typeid为旋转类型时每次旋转的角度 默认为10。
:param typename: 无感学习子类型名称(可为空):用户自定义(需自己记住,不同时为不同的无感学习)。typeid为(7: 无感学习)时传
:param imageback: 缺口识别2张图传背景图需要
:param content: 标题内容 如:填写 "你好"中文请unicode编码以免造成错误。
:param title_image: 快速点选需要。
:param timeout: 超时时间
:return:
- __init__(self)
- Initialize self. See help(type(self)) for accurate signature.
- addlist(self, list, index=None, val=None, exc=0)
- @param list: 列表
@param index: 编辑器默认”最后“,否则为数组下标,int类型
@param val: 插入的内容
@return:
- aes_decode(self, text, key, exc=0)
- :param text: 解密信息
:param key: 密钥
:param exc: 异常处理
:return:
- aes_encode(self, text, key, exc=0)
- :param text: 加密信息
:param key: 密钥
:param exc: 异常处理
:return:
- all_str(self, val)
- # 转字符串
- base64_decode(self, cipher, is_url_safe=False, exc=0)
- :param cipher: 加密信息
:param is_url_safe: 是否url
:param exc: 异常处理
:return:
- base64_encode(self, plain, is_pic=False, exc=0)
- :param plain: 加密信息
:param is_pic: 是否图片
:return:
- close_database(self, database)
- #关闭数据库链接
- common_date_calculation(self, option=0, out_format='%Y-%m-%d', today='')
- :param today: str,指定日期,如果是当天,不需要传具体内容,可以传“”
:param option: int,选项:
0-今天;1-昨天;2-明天;
3-本周第一天;4-本周最后一天;
5-下周第一天;6-下周最后一天;7-下周同一天;
8-上周第一天;9-上周最后一天;10-上周同一天;
11-本月第一天;12-本月最后一天;
13-上月第一天;14-上月最后一天;15-上月同一天;
16-下月第一天;17-下月最后一天;18-下月同一天;
19-本季度第一天;20-本季度最后一天;
21-上季度第一天;22-上季度最后一天;23-上季度同一天
24-下季度第一天;25-下季度最后一天;26-下季度同一天;
27-本年第一天;28-本年最后一天;
29-上年第一天;30-上年最后一天;31-上年同一天;
32-下年第一天;33-下年最后一天;34-下年同一天;
:param out_format:str, 包括"%Y-%m-%d"、"%Y/%m/%d"、"%Y-%m-%d %H:%M:%S"、"%Y/%m/%d %H:%M:%S"、"%Y-%m-%d %H:%M"、"%Y/%m/%d %H:%M"、
"%Y"、"%m"、"%d"、"%H"、"%M"、"%S","%Ynian%myue%dri"(年月日形式)、"%Ynian%myue%dri %H:%M:%S"(年月日形式)、
"%Ynian%myue%dri %H:%M"(年月日形式)、"2000-1-1"、"2000-1-01"、"2000-01-1"、"2000/1/1"、"2000/1/01"、"2000/01/1"
:return:str,计算后的日期
- compare_version(self, version1, version2)
- # version1是否大于等于version2
- config_out(self, ide_name, nass_name, type, strs)
- :param ide_name: 编辑器的配置项名
:param nass_name: nass上的配置项名
:param type: 配置项类型
:param strs: 文件名或字符串
:return:
- connect_database(self, connect_str)
- #链接数据库
- convert_to_binary(self, file_path, exc=0)
- :param file_path: 文件路径
:param exc: 异常处理:0-抛出异常,1-忽略异常
:return:
- copy_file(self, inputfilepath, outfilepath, type)
- @param inputfilepath: 源文件
@param outfilepath: 目标文件夹
@param type: 如果文件存在
@return:
- copy_file_val(self, inputfile, outfile)
- :param inputfile: 输入文件
:param outfile: 输出文件
:return:
- copy_rename_file(self, inputfilepath='', outfilepath='', newname='', exc=0)
- @param inputfilepath: 源文件
@param outfilepath: 目标文件夹
@param newname: 新文件名
@param exc: 异常处理
@return:
- creat_list(self, exc=0)
- #创建空列表
- create_dict(self, exc=0)
- :param exc:int,异常处理
:return:dict
- create_file(self, filepath, dirpath, name, type)
- @param filepath: 如果是文件,则传这个地址
@param dirpath: 如果是创建问价夹传这个地址
@param name: 文件名
@param type: 如果文件已存在
@return:
- create_file_txt(self, filepath='', name='', type='覆盖', encode='utf-8')
- @param filepath: str,文件目录
@param name: str,文件名称
@param type: str,如果文件已存在
@param encode: str,编码格式
@return:
- data_str_converts(self, val='', outputtype='', exc=0, inputtype='')
- @param val:str,带转换的时间字符串,包括'%Y-%m-%d 00:00:00';'%Y/%m/%d 00:00:00';'%Y%m%d 00:00:00';'%Y年%m月%d日 00:00:00';
'%Y-%m-%d';'%Y/%m/%d';'%Y%m%d';'%Y年%m月%d日'八类格式
@param inputtype:str,输入格式,默认''
@param outputtype:str, 包括"%Y-%m-%d"、"%Y/%m/%d"、"%Y-%m-%d %H:%M:%S"、"%Y/%m/%d %H:%M:%S"、"%Y-%m-%d %H:%M"、"%Y/%m/%d %H:%M"、
"%Y"、"%m"、"%d"、"%H"、"%M"、"%S","%Ynian%myue%dri"(年月日形式)、"%Ynian%myue%dri %H:%M:%S"(年月日形式)、
"%Ynian%myue%dri %H:%M"(年月日形式)、"2000-1-1"、"2000-1-01"、"2000-01-1"、"2000/1/1"、"2000/1/01"、"2000/01/1"
@return:str,转换后的时间文本
- del_space(self, val, types, exc=0)
- :param val: 源文本信息
:param types: 去除方式,0-去除所有空格,1-去除n-1个空格
:return:
- delete_dict_key(self, dict_param={}, key='', exc=0)
- :param dict_param:dict,待删除字典
:param key: str,字典的key
:param exc:int,异常处理
- delete_file(self, path)
- @param path: 文件或者文件夹
@return:
- delete_repeat(self, target_list, exc=0)
- @param target_list: 列表
@return: 列表
- deletelist(self, list, one_all, index_val=None, val=None, column_index=0, exc=0)
- @param list: list,列表
@param one_all:str “清空”或者“删除一项”、"删除列"(仅针对二维数组)
@param index_val: str,包括“按照内容删除”或者“按照下标删除”
@param val: 当按内容删除是为str类型,列表项的内容;按照下标删除为int类型,列表项的下标
@param column_index: int,删除列时的列数,从1开始
@return:list
- des_decode(self, cipher, key)
- des_encode(self, plain, key)
- disable_quick_edit(self)
- download_file(self, url, filename=None, cookie=None, exc=0, duplicate=1)
- :param url: 下载连接
:param filename: 下载文件名
:param cookie: 是否需要cookie
:param exc: 异常处理:0-抛出异常,1-继续
:param duplicate: 重复文件:0-抛出异常,1-覆盖
:return:
- dt_2_dts(self, date_time)
- #将datatime格式时间转换为“年-月-日 时:分:秒”格式的字符串
- dt_2_ts(self, date_time)
- #将datatime对象转成秒数
- dts_2_dt(self, date_time_string)
- #将字符串格式的时间转为datatime格式时间
- dts_2_ts(self, date_time_string)
- #将“年-月-日 时:分:秒”格式的时间转化为数字秒数
- execute_sql(self, database, sql_str)
- #执行sql语句
- export_file(self, inputfilepath, outfilepath)
- :param inputfilepath: 输入文件
:param outfilepath: 输出文件
:return:
- filter_data(self, from_list, column_n=None, flg=None, filter_value=None)
- :param list: 待处理的列表
:param column_n: 列名,int类型从0开始
:param flg: 条件:int类型,0:包含
1:不包含
2:大于
3:小于
4:等于
5:不等于
6:大于或等于
7:小于或等于
:param filter_value:筛选过滤值
:return:
- format_file_size(self, size)
- #将文件大小加上单位
- get(self, url, headers=None, proxies=None, timeout=0)
- get_abspath(self, path='', exc=0)
- #获取数据资源管理器内容绝对路径
- get_and_remove_line(self, file_name)
- get_clipboard(self)
- # 读取剪切板
- get_cloud_netdisk(self, id='', exc=0)
- :param id:密码id
:param exc:异常处理
:return:用户名,密码
- get_cloud_netdisk_txt(self, id='', exc=0)
- :param id:密码id
:param exc:异常处理
:return:用户名,密码
- get_current_ip(self)
- #获取ip(本地)
- get_current_time(self)
- #获取当前时间
- get_current_time_ali(self)
- #获取当前时间
- get_current_timestamp10(self)
- #获取10位时间戳
- get_current_timestamp13(self)
- #获取13位时间戳
- get_date_list(self, days)
- @param days: int类型,1为今天,2为今天+昨天,依次类推
@return:list
- get_dict(self, str)
- #把字符串转成json
- get_dict_key(self, dict_param={}, exc=0)
- :param dict_param: dict,字典
:param exc: int,异常处理
:return: list,字典的key
- get_dict_value(self, dict_param={}, key='', is_exist=1, default_value='where is key', exc=0)
- :param dict_param: dict,需要设置的字典
:param key:非list/dict/set之外的任意类型
:param default_value:任意类型
:param is_exist:int,如果键名不存在,1-返回默认值,0-报错
:param exc:int,异常处理
:return: 任意类型
- get_dict_value_list(self, dict_param={}, exc=0)
- :param dict_param: dict,字典
:param exc: int,异常处理
:return: list,字典的value
- get_dir_name(self, filepath, timeout=3000, exc=0)
- '
:param filepath: str,文件路径
:param timeout: int,超时时间
:param exc: int,异常处理:0-抛异常,1-不抛异常
:return: str,文件名
- get_ecommerce_comment(self, appkey='yn000101', appsecret='B8N>^1o,6,>?XM^j.sZU', user_id='', username='', email='', platform_id='', start_time_id='', end_time_id='', product_select_type='by_filter', system_category_ids=[], brand_ids=[], shop_ids=[], title_include_type='', title_include_keywords=[])
- :param appkey: str,应⽤key
:param appsecret:str,应用密钥
:param user_id:str,用户id
:param username:str,用户名
:param email:str,邮箱地址(目前没用)
:param platform_id:str,平台id
:param start_time_id:str,起始时间ID, 格式: YYYY-mm-dd
:param end_time_id:str,结束时间ID, 格式: YYYY-mm-dd, 限制: 时间跨度不超过7天
:param product_select_type:str,商品选择⽅式, by_filter范围: "by_filter"筛选商品 "by_appoint"指定商品,目前默认'by_filter'
:param system_category_ids:array,类⽬ID列表, 最⼤不超过100个
:param brand_ids:array,品牌ID列表, 最⼤不超过100个;
:param shop_ids:array,店铺ID列表, 最⼤不超过100个;
:param title_include_type:str,商品标题关键词之间的关系(范围: "and"包含全部关键词 "or"包含任意关键词)
:param title_include_keywords:array,商品标题关键词列表,
:return:str,生成结果地址
- get_email(self, imap_ssls, username, password, Seen, nums, enclosurepath, values, mail_host_custom='', host=993, flags=False)
- @param imap_ssls: 邮箱服务器
@param username: 用户名
@param password: 用户密码
@param Seen: 是否读取已读:未读传‘UnSeen’,所有传‘ALL’,已读传‘Seen’
@param nums: 获取数量,int类型,如果是时间最新的在前面则传负数
@param enclosurepath:存放附件的地址
@param values:读取内容,数组,list类型,如['时间','正文内容']
@:param flags:读取之后是否将邮件标注为已读
@return:数组,所有邮件的list,list中每个邮件是个字典
- get_file_base64(self, path)
- #可逆加密
- get_file_list(self, path, type, type_value, fileordir, son=1, deep=10)
- @param path: str,文件夹地址
@param type: str,获取类型,如按文件名获取,按文件类型获取
@param type_value: str,按文件名获取,按文件类型获取模糊匹配的值
@param fileordir: str,获取类型,如文件、文件夹
@param son: int,是否包含子文件夹:1-包含,0-不包含
@param deep: int,子文件层级
@return:list
- get_file_mtime(self, path)
- #获取文件修改时间
- get_file_name(self, filepath, suffix=1, timeout=3000, exc=0)
- :param filepath: str,文件路径
:param suffix: int,是否包含后缀:1-包含后缀,0-不包含后缀
:param timeout: int,超时时间
:param exc: int,异常处理:0-抛异常,1-不抛异常
:return: str,文件名
- get_file_size(self, path)
- #获取文件大小
- get_header_fs(self, request_type='post', json=None, data=None, time_out=1)
- :param request_type: str,请求类型,默认post
:param json: json,json参数
:param data: str,data参数
:param time_out: int,超时时间
:return:
- get_hmac_sha265(self, plain, key=None, is_hex=True)
- #不可逆键值对方式加密
- get_json(self, dict)
- @param dict: 字典类型
@return:
- get_md5(self, plain)
- # --------------------Crypt--------------------
#MD5加密
- get_monday_to_sunday(self, today, weekly=0, weekday='')
- :function: 获取指定⽇期的周几的⽇期
:param today: '2021-11-16'; 当前⽇期:today = datetime.now().strftime('%Y-%m-%d')
:param weekly: 获取指定⽇期的上⼏周或者下⼏周,weekly=0当前周,weekly=-1上⼀周,weekly=1下⼀周
:param weekday: 周几,如”周一“
:return: 返回指定⽇期的周几⽇期
- get_rand_line(self, file_name)
- get_rand_string(self, len, force=False, exc=0)
- #生成随机字符串
- get_short(self, text, length)
- @param text: 字符串
@param length: 截取长度
@return:
- get_str_len(self, val, exc=0)
- #获取文本长度
- get_text_html(self, html_str, encoding='utf-8', exc=0)
- :param html_str: html原文
:param encoding: html原文编码格式
:param exc: 异常处理:0-抛出异常,1-忽略继续
:return:
- get_uuid(self)
- #获取UUID
- getlistindex(self, list, val, exc=0)
- @param list: 列表
@param val: 数组内容
@return:
- getlistlen(self, lists, exc=0)
- #获取列表长度
- getlistvalue(self, list, index, exc=0)
- @param list: 列表
@param index: 数组下标,int类型
@return:
- getocr_1(self, fic='', exc=0)
- :param fic:图片地址
:param exc:异常处理
:return:
- getocr_2(self, pic_type=1, img_path='', out_type=1, save_folder='', exc=0)
- :param pic_type:int:1-标准图片,2-表格图片
:param img_path:图片文件地址
:param out_type:输出类型(只有类型选择表格时显示,下拉):1-二维数组,2-excel(返回excel路径)
:param save_folder:excel保存路径(只有类型选择表格时显示,下拉)
:param exc:异常处理
:return:
- hex_decode(self, cipher)
- hex_encode(self, plain)
- input_user(self, msg, timeout=0, exc=0)
- :param msg:
:return:
- int_2_str(self, number, base)
- @param number: 要转的数字,int类型
@param base: 进制(2到16),int类型
@return:
- is_true_file(self, file, timeout=0)
- :param file: 路径
:param timeout: 超时
:return:
- kill_app(self, appname)
- @param appname: 进程名
@return:
- launch_app(self, path)
- list_sorted(self, from_list, column_n, type, reverse)
- :param from_list: 待排序list
:param column_n:列数:int类型,从0开始计算
:param type:按字母或者数字:int类型,0-数字,1-字母
:param reverse:升序降序:bool类型,True-降序,False-升序
:return:排序后list
- list_to_json(self, param_list=[], exc=0)
- :param param_list: list,待转list
:param exc: int,异常处理,0-抛出异常,1-忽略异常
:return: 一维返回json,二维返回list
- move_file(self, inputfilepath, outfilepath, type)
- @param inputfilepath: 源文件
@param outfilepath: 目标文件夹
@param type: 如果文件存在
@return:
- msgbox(self, text='点击确定继续', title='消息弹框')
- #消息弹框
- num_to_char(self, param_num='', param_format=0, exc=0)
- :param param_num: str,待转换的数字
:param param_format: int,转换格式:
0-阿拉伯数字转简体汉字(123转为一二三);
1-阿拉伯数字转大写汉字(123转为壹贰叁);
2-简体汉字写法的数字(123转为一百二十三);
3-大写汉字写法的数字(123转为壹百贰拾叁);
4-财务大写格式(123转为壹佰贰拾叁元整);
5-简体汉字转阿拉伯数字(一二三转为123);
6-大写汉字转阿拉伯数字(壹贰叁转为壹贰叁123);
7-简体汉字写法的数字转阿拉伯数字(一百二十三转为123);
8-大写汉字写法的数字转阿拉伯数字(壹百贰拾叁转为123);
9-财务大写格式转为阿拉伯数字(壹佰贰拾叁元整转为123);
:param exc:int,异常处理,0-抛出异常,1-忽略异常
:return: str,转换后的数字
- pad(self, data_to_pad, block_size, style='pkcs7')
- # https://en.wikipedia.org/wiki/Padding_(cryptography)#Zero_padding
- post(self, url, json=None, data=None, headers=None, proxies=None, timeout=0)
- data与json既可以是str类型,也可以是dict类型。
区别:
1、不管json是str还是dict,如果不指定headers中的content-type,默认为application/json
2、data为dict时,如果不指定content-type,默认为application/x-www-form-urlencoded,相当于普通form表单提交的形式
3、data为str时,如果不指定content-type,默认为application/json
4、用data参数提交数据时,request.body的内容则为a=1&b=2的这种形式,用json参数提交数据时,request.body的内容则为'{"a": 1, "b": 2}'的这种形式
- print_log(self, val)
- #输出到控制台
- re_matching(self, strs, types, res, cap, exc=0)
- :param strs: 源文本内容
:param types:选择规则:0-邮箱,1-身份证号,2-手机号,3-数字,4-英文,5-自定义
:param res:正则表达式
:param cap:大小写 0-大写。1-不区分大写
:return:
- read_csv(self, file_name, encoding='utf-8', exc=0)
- :param file_name: str,文件地址
:param encoding: str,编码格式
:return: list
- read_data(self, file_name='data.txt', encoding='utf-8')
- :param file_name:str,文件path
:param encoding: str,编码格式
:return:
- rename_file(self, inputfilepath, newname, type, exc=0)
- @param inputfilepath: 源文件
@param newname: 新名称
@param type: 选项
@param exc: 异常处理
@return:
- replace_re(self, source_text, types, res, replace_text, exc=0)
- :param source_text: 源文本内容
:param types: 选择规则:0-邮箱,1-身份证号,2-手机号,3-数字,4-大写英文,5-小写英文,6-自定义
:param res: 自定义的正则表达式
:param replace_text: 替换内容
:param exc: 异常处理,0-抛出异常,1-忽略错误继续
:return:
- report_results(self, taskId='', taskRemark='', start='', end='', isTaskError='', totalCount='', errorCount='', successCount='')
- :param taskId: 单据id
:param taskRemark: 备注
:param start: 开始时间
:param end: 结束时间
:param isTaskError:状态,1-成功,2-失败
:param totalCount:总数
:param errorCount:失败数
:param successCount:成功数
:return:
- rsa_decode(self, cipher, key, is_hex=True)
- # name ssss
# -sss sss
- rsa_encode(self, plain, key, is_hex=True)
- # https://www.jb51.net/article/86022.htm
# plain 最大长度是 证书key位数/8 - 11
- run_ipass(self, main_path='', in_json={}, exc=0)
- :param main_path: str,ipass的执行文件路径
:param in_json: dict,入参
:param exc: int,异常处理
:return:dict, ipass的返回
- run_ipass_0103(self, main_path='', in_json={}, exc=0)
- :param main_path: str,ipass的执行文件路径
:param in_json: dict,入参
:param exc: int,异常处理
:return:dict, ipass的返回
- send_email(self, mail_host, mail_user, mail_pass, to_reciver, cc_reciver, bcc_reciver, Subject, attachments, text, mail_host_custom='', mail_port=465)
- @param mail_host: 邮件服务器,仅限mail_dict中列出的邮箱
@param mail_user: 发送者邮箱用户名
@param mail_pass: 发送者邮箱密码
@param to_reciver: 接受者,可发送多个人,必须用“[]”包起来,以“;”隔开
@param cc_reciver: 抄送,可抄送多个人,必须用“[]”包起来,以“;”隔开
@param bcc_reciver: 密送,可抄送多个人,必须用“[]”包起来,以“;”隔开
@param Subject: 主题
@param attachment: 附件,可以多个附件,必须用“[]”包起来,以“;”隔开
@param text: 正文
@return:
- set_clipboard(self, aString)
- # 写入剪切板
- set_key_value(self, dict_param={}, key='', value='', is_repeat=1, exc=0)
- :param dict_param: dict,需要设置的字典
:param key:非list/dict/set之外的任意类型
:param value:任意类型
:param is_repeat:int,如果键名重复,1-修改键名对应的值,0-报错
:param exc:int,异常处理
:return:dict
- setlistvalue(self, list, index, val, exc=0)
- @param list: 列表
@param index: 数组下标,int类型,从0开始
@return:
- split_text(self, val, flg, exc=0)
- :param val: 源文本内容
:param flg: 截取标志
:return:
- str_add(self, *args, exc=0)
- :param args:任意多个要相加的字符串
:param exc:异常处理,必须传‘exc=1’的形式,不能只传一个数字1,以便区别不是要相加的字符串
:return:
- str_contains(self, str, sub, sep=',')
- @param str: 字符串
@param sub: 目标字符串
@param sep: 分割标志
@return:
- str_in_strs(self, str_all='', str_find='', is_in=True, exc=0)
- :param str_all: str,完整内容
:param str_find: str,带查找字符串
:param is_in: bool,是否存在,true-存在,false-不存在
:param exc: int,异常处理,0-抛出异常,1-忽略
:return:bool
- str_split(self, str, sep=',')
- @param str: 字符串
@param sep: 分割标志
@return:
- text_replace(self, text, old_text, new_text, exc=0)
- :param text: 字符串
:param old_text: 替换内容
:param new_text: 替换的新内容
:return:
- text_separating(self, text, type='', firstval='', lastval='', startval='', endval='', exc=0)
- :param text: 目标文本
:param type: 按位置截取或者按内容截取
:param firstval: 从第一个位置或从文本开头截取到指定位置或指定文本(按位置时为int类型,按照内容时为str类型)
:param lastval:从指定位置或指定文本截取到最后(按位置时为int类型,按照内容时为str类型)
:param startval:指定开始位置或内容(按位置时为int类型,按照内容时为str类型)
:param endval:指定结束位置或内容(按位置时为int类型,按照内容时为str类型)
:return:str类型
- time_between(self, start_date, end_date, units)
- :param start_date: 开始时间
:param end_date: 结束时间
:param units: 计算单位:如“YEARLY”, “MONTHLY”,“WEEKLY”,“DAILY”, “HOURLY”, “MINUTELY”, “SECONDLY”(对应年月日周时分秒)
:return:int类型
- time_calc(self, oldtime, lenth, unit, exc=0)
- @param oldtime:原时间,string类型,格式如:%Y-%m-%d或者%Y-%m-%d %H:%M:%S,其他格式不支持
@param lenth:增加或减少的时间,正数为增加,负数为减少,int类型
@param unit:时间单位:年月日时分秒
@return:string类型
- transform_path(self, file_path)
- ts_2_dt(self, time_stamp)
- #将时间戳转为datatime对象
- ts_2_dts(self, time_stamp)
- #将秒数转化为“年-月-日 时:分:秒”格式的字符串
- unpad(self, padded_data, block_size, style='pkcs7')
- update_cloud_netdisk(self, usr='', pwd='', data='', id='', exc=0)
- :param usr:用户名
:param pwd:密码
:param filename:密码名称
:param id:密码id
:param exc:异常处理
:return:
- write_data(self, data, file_name='data.txt', encoding='utf-8', mode='a')
- :param data: str,写入内容
:param file_name:str,文件path
:param encoding: str,编码格式
:param mode: str,写入方式
:return:
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
| |