xtn-tools-pro 1.0.0.0.0__tar.gz → 1.0.0.0.1__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {xtn-tools-pro-1.0.0.0.0/xtn_tools_pro.egg-info → xtn-tools-pro-1.0.0.0.1}/PKG-INFO +1 -1
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/setup.py +1 -1
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/xtn_tools_pro/tools.py +4 -2
- xtn-tools-pro-1.0.0.0.1/xtn_tools_pro/tools_flie.py +41 -0
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/xtn_tools_pro/tools_time.py +1 -1
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1/xtn_tools_pro.egg-info}/PKG-INFO +1 -1
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/xtn_tools_pro.egg-info/SOURCES.txt +1 -0
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/LICENSE +0 -0
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/README.md +0 -0
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/setup.cfg +0 -0
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/xtn_tools_pro/__init__.py +0 -0
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/xtn_tools_pro/db/MongoDB.py +0 -0
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/xtn_tools_pro/db/RedisDB.py +0 -0
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/xtn_tools_pro/db/__init__.py +0 -0
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/xtn_tools_pro.egg-info/dependency_links.txt +0 -0
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/xtn_tools_pro.egg-info/requires.txt +0 -0
- {xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/xtn_tools_pro.egg-info/top_level.txt +0 -0
@@ -59,7 +59,6 @@ def get_file_md5_16(file_path):
|
|
59
59
|
return result[8:24]
|
60
60
|
|
61
61
|
|
62
|
-
|
63
62
|
def get_str_to_json(str_json):
|
64
63
|
"""
|
65
64
|
字符串类型的json格式 转 json
|
@@ -101,6 +100,9 @@ def get_calculate_total_page(total, limit):
|
|
101
100
|
return total_pages
|
102
101
|
|
103
102
|
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
104
107
|
if __name__ == '__main__':
|
105
108
|
pass
|
106
|
-
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#!/usr/bin/env python
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
|
4
|
+
# 说明:
|
5
|
+
# 文件相关的工具
|
6
|
+
# History:
|
7
|
+
# Date Author Version Modification
|
8
|
+
# --------------------------------------------------------------------------------------------------
|
9
|
+
# 2024/4/19 xiatn V00.01.000 新建
|
10
|
+
# --------------------------------------------------------------------------------------------------
|
11
|
+
import os, re
|
12
|
+
|
13
|
+
|
14
|
+
def get_file_extension(file_name):
|
15
|
+
"""
|
16
|
+
根据文件名获取文件扩展名/后缀名
|
17
|
+
:param file_name: 文件名称
|
18
|
+
:return:
|
19
|
+
"""
|
20
|
+
_, file_extension = os.path.splitext(file_name)
|
21
|
+
return file_extension
|
22
|
+
|
23
|
+
|
24
|
+
def get_check_filename(file_name):
|
25
|
+
"""
|
26
|
+
传入文件名返回一个合法的文件名 会替换掉一些特殊符号 常用于爬虫写文件时文件名中带有特殊符号的情况...
|
27
|
+
:param filename: 文件名
|
28
|
+
:return:
|
29
|
+
"""
|
30
|
+
file_extension = get_file_extension(file_name)
|
31
|
+
# 删除非法字符
|
32
|
+
sanitized_filename = re.sub(r'[\/:*?"<>|]', '', file_name)
|
33
|
+
max_length = 255 # 操作系统限制文件名的最大长度为255个
|
34
|
+
sanitized_filename = sanitized_filename[:max_length]
|
35
|
+
return sanitized_filename
|
36
|
+
|
37
|
+
|
38
|
+
if __name__ == '__main__':
|
39
|
+
pass
|
40
|
+
print(get_file_extension('file/2024-04-19/BOSCH GEX 125-1A/125-1AE砂磨机操作说明书:[1]_jingyan.txt'))
|
41
|
+
print(get_check_filename('file/2024-04-19/BOSCH GEX 125-1A/125-1AE砂磨机操作说明书:[1]_jingyan.txt'))
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{xtn-tools-pro-1.0.0.0.0 → xtn-tools-pro-1.0.0.0.1}/xtn_tools_pro.egg-info/dependency_links.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|