一些python对象的一些特殊函数。
FreqObjectOps的Python项目详细描述
freqobjectops
一些python对象的一些特殊函数。
要求
- python 3+(在3.7中测试)
- 熊猫>;=0.25.0
- Pytest=5.0.1
- Unidecode=1.0.22
使用PIP安装
$ pip install FreqObjectOps
用法
- 导入库。
fromFreqObjectOpsimportDateOps,DirOps,ListOps,StrOps
- 每个导入的子模块都有几个函数。有关详细信息,请参阅相应的帮助。
DateOps
DateOps.get_year(date_entity, date_format)
:从日期获取年份DateOps.text_to_datetime(text, date_format)
:将文本转换为日期DateOps.get_difference_in_year(from_date, to_date, date_format)
:获取两个日期之间的更正年份差异
DirOps
DirOps.get_directory_from_filepath(filepath)
:从文件路径获取目录DirOps.get_basename_from_filepath(filepath)
:从文件路径获取basenameDirOps.get_file_extension_from_filepath(filepath)
:从文件获取文件扩展名- {< CD9> }:检查文件夹是否存在
DirOps.get_filtered_list_without_temporary_files(file_list)
:从文件列表中筛选临时文件DirOps.get_all_files_in_directory(folder_path, pattern, recursive)
:获取目录中与特定模式匹配的所有文件DirOps.get_latest_file_in_directory(folder_path, pattern)
:在与特定模式匹配的目录中获取最新文件DirOps.get_abs_path(filepath)
:获取文件路径的绝对路径
ListOps
ListOps.remove_duplicates(unfiltered_list, sorted, reversed)
:使用唯一元素获取筛选列表ListOps.get_intersection(list_one, list_two)
:在两个列表之间获取公共元素ListOps.get_union(list_one, list_two)
:获取两个列表之间的所有元素ListOps.get_flat_list(list_of_lists)
:获取扁平列表
StrOps
StrOps.is_camel_case(text)
:检查文本是否为camelcase格式StrOps.remove_accent(text)
:从文本中删除重音StrOps.clean_snake_case(text)
:干净的蛇壳StrOps.text_to_alpha_numeric(text, replace_string)
:从文本中删除非字母数字字符StrOps.text_to_camel_case(text, case)
:将文本转换为camelcaseStrOps.camel_case_to_snake_case(text, case)
:将camelcase转换为snake\u caseStrOps.text_to_snake_case(text, case)
:将文本转换为snake\u大小写