Skip to content

Commit 60c0db1

Browse files
committed
🔊添加复用函数功能
1 parent 74bd370 commit 60c0db1

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

Util/__init__.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,56 @@
3131
from .Command import Command
3232
from .Profile import Profile
3333
from .Download import Download
34+
from .Images import Images
3435

3536
# 日志记录
3637
log = Log()
38+
39+
headers = {
40+
'user-agent': 'Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36 Edg/87.0.664.66'
41+
}
42+
43+
def replaceT(obj):
44+
"""替换文案非法字符
45+
46+
Args:
47+
obj (_type_): 传入对象
48+
49+
Returns:
50+
new: 处理后的内容
51+
"""
52+
# '/ \ : * ? " < > |'
53+
reSub = r"[\/\\n\:\*\?\"\<\>\|]"
54+
new = []
55+
if type(obj) == list:
56+
for i in obj:
57+
# 替换为下划线
58+
retest = re.sub(reSub, "_", i)
59+
new.append(retest)
60+
elif type(obj) == str:
61+
obj.replace('\\','')
62+
obj.replace('\/','')
63+
obj.replace(':','')
64+
obj.replace('*','')
65+
obj.replace('?','')
66+
obj.replace('<','')
67+
obj.replace('>','')
68+
obj.replace('|','')
69+
obj.replace('"','')
70+
new = obj.replace('\n','')
71+
# 替换为下划线
72+
# new = re.sub(reSub, "_", obj, 0, re.MULTILINE)
73+
return new
74+
75+
if (platform.system() == 'Windows'):
76+
sprit = '\\'
77+
# 💻
78+
print('[ 💻 ]:Windows平台')
79+
elif (platform.system() == 'Linux'):
80+
sprit = '/'
81+
# 🐧
82+
print('[ 🐧 ]:Linux平台')
83+
else:
84+
sprit = '/'
85+
# 🍎
86+
print('[ 🍎 ]:MacOS平台')

0 commit comments

Comments
 (0)