minor fix

This commit is contained in:
2025-07-16 11:23:25 +08:00
parent a2cb6080b0
commit 4886b18579
2 changed files with 6 additions and 3 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,5 @@
.vscode/ .vscode/
.venv/ .venv/
*.csv *.csv
*.bat *.bat
*.xlsx

View File

@@ -43,12 +43,12 @@ def main():
workbook = pandas.read_excel(args.input) workbook = pandas.read_excel(args.input)
data = workbook.where(pandas.notnull(workbook), None).to_dict(orient='list') data = workbook.where(pandas.notnull(workbook), None).to_dict(orient='list')
recipients = data.get(args.column_address, []) recipients = data.get(args.column_address, [])
codes = data.get(args.column_code, [])
except Exception as e: except Exception as e:
print(f'[!!!!] 读取数据表失败:{e}') print(f'[!!!!] 读取数据表失败:{e}')
return 1 return 1
limit = len(recipients) limit = len(recipients)
codes = data.setdefault(args.column_code, [None] * limit)
sents = data.setdefault(args.column_sent, [None] * limit) sents = data.setdefault(args.column_sent, [None] * limit)
print(f'[信息] 已读取联系人信息共 {limit}') print(f'[信息] 已读取联系人信息共 {limit}')
@@ -171,7 +171,9 @@ def main():
while active and index < limit: while active and index < limit:
recipient = recipients[index] recipient = recipients[index]
code = codes[index] code = codes[index]
occurrence = occurrences.setdefault(code, [0])
if not code: occurrence = [0]
else: occurrence = occurrences.setdefault(code, [0])
current = index current = index
index += 1 index += 1