Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apex IP 更新 #563

Merged
merged 3 commits into from
Jan 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add files via upload
对比规则进行更新
  • Loading branch information
Xqing-hup authored Jan 13, 2024
commit 650a63b96b1217edf5d9742ae8ebd1d8e4e98262
43 changes: 43 additions & 0 deletions tools/合并.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
file_path = "Apex.rules"
_file_path = "1.rules"

def open_ru(path):
with open(path, "r") as file:
temp = file.readline()
data_list = []
while True:
data = file.readline().split("\n")
if len(data) == 1:
break
data_list.append(data[0])
return data_list

def slist(list:list, data):
for i in list:
if i == data:
return True
return False

def gengx(path, data:list):
with open(path, "a", encoding='utf-8') as gengx:
for i in data:
gengx.write(i+"\n")


if __name__ == "__main__":
file_path = str(input("输入需要更新文件:"))
_file_path = str(input("输入最新文件名:"))


yuan_list = open_ru(file_path)
geng_list = open_ru(_file_path)
gengx_list = []
for i in geng_list:
if slist(yuan_list, i):
pass
else:
print(f'添加: {i}')
gengx_list.append(i)
gengx(file_path, gengx_list)

print(f'更新结束 共:{len(gengx_list)}条')