代码拉取完成,页面将自动刷新
import os
import sys
from datetime import datetime
import numpy as np
import pandas as pd
from settings import PATH
def check_validity():
commit_data_file = pd.read_csv(PATH["commit_data_file_path"])
df = pd.DataFrame(commit_data_file)
flag = True
index = 1
for i in range(df.shape[0]):
data_list = df.iloc[i].values.tolist()
count = sum([num for num in data_list[2:19] if num > 0]) + len([num for num in data_list[19:23] if 90 <= num <= 225])
if count != 4:
print(f"{index} ->\t{df.loc[i, 'folder']}")
flag = False
index += 1
elif data_list[-3] > 2 or data_list[-3] < 0:
print(f"{index} ->\t{df.loc[i, 'folder']}")
flag = False
index += 1
return flag
if __name__ == "__main__":
commit_data_file = pd.read_csv(PATH["commit_data_file_path"])
file = open(os.path.join(PATH["data_dir"], "hand_record_data.txt"))
df = pd.DataFrame(commit_data_file)
if df.shape[0] > 0:
df = df.iloc[:0]
df.to_csv(PATH["commit_data_file_path"], encoding="GB2312", index=False)
print(df.shape)
line = file.readline()[:-1]
count = 1
while line:
commit_data_dict = {
"user": "VirtualRiot",
"datetime": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"oxycola": 0,
"coolant": 0,
"tempura": 0,
"repair": 0,
"ammo": 0,
"klxd1": 0,
"klxd2": 0,
"klxd3": 0,
"wsk1": 0,
"wsk2": 0,
"wsk3": 0,
"zwzg1": 0,
"zwzg2": 0,
"zwzg3": 0,
"blk1": 0,
"blk2": 0,
"blk3": 0,
"coin1": 0,
"coin2": 0,
"coin3": 0,
"coin4": 0,
"j113": 0,
"checked": True,
"folder": count
}
count += 1
item_list = line.split(" ")
coin_list = [0, 0, 0, 0]
for item in item_list:
if item.isdigit():
coin_list[coin_list.index(0)] = int(item)
elif "j113" in item:
commit_data_dict["j113"] = int(item[-1])
elif "klxd" in item:
if len(item) > 5:
commit_data_dict[item[:-1]] = int(item[-1])
else:
commit_data_dict[item] = 1
elif "wsk" in item:
if len(item) > 4:
commit_data_dict[item[:-1]] = int(item[-1])
else:
commit_data_dict[item] = 1
elif "zw" in item:
if len(item) > 3:
commit_data_dict["zwzg" + item[2]] = int(item[-1])
else:
commit_data_dict["zwzg" + item[2]] = 1
elif "blk" in item:
if len(item) > 4:
commit_data_dict[item[:-1]] = int(item[-1])
else:
commit_data_dict[item] = 1
elif "kl" in item:
if len(item) > 2:
commit_data_dict["oxycola"] = int(item[-1])
else:
commit_data_dict["oxycola"] = 1
elif "lqs" in item:
if len(item) > 3:
commit_data_dict["coolant"] = int(item[-1])
else:
commit_data_dict["coolant"] = 1
elif "tfl" in item:
if len(item) > 3:
commit_data_dict["tempura"] = int(item[-1])
else:
commit_data_dict["tempura"] = 1
elif "dy" in item:
if len(item) > 2:
commit_data_dict["ammo"] = int(item[-1])
else:
commit_data_dict["ammo"] = 1
elif "wx" in item:
if len(item) > 2:
commit_data_dict["repair"] = int(item[-1])
else:
commit_data_dict["repair"] = 1
coin_list.sort(reverse=True)
for i, coin in enumerate(coin_list):
commit_data_dict[f"coin{i + 1}"] = coin
df = df.append([commit_data_dict], ignore_index=True)
df.to_csv(PATH["commit_data_file_path"], mode="a", encoding="GB2312", index=False, header=False)
df = df.iloc[:0]
line = file.readline()[:-1]
is_valid = check_validity()
if is_valid:
print("Complete <success>")
else:
print("Complete <invalid data found>")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。