update: fixed errrors with recipient with whitespaces

This commit is contained in:
2025-08-13 14:30:58 +08:00
parent 6597ced3cb
commit 62a74292d3

View File

@@ -272,7 +272,7 @@ def main():
current = index current = index
index += 1 index += 1
recipient = recipients[current] recipient = str(recipients[current]).strip()
name = names[current] name = names[current]
code = codes[current] code = codes[current]
mark = sents[current] mark = sents[current]
@@ -386,17 +386,15 @@ def main():
progress = index / limit * 100 progress = index / limit * 100
print('[信息] 当前进度:%.2f %%' % progress) print('[信息] 当前进度:%.2f %%' % progress)
key = input('[????] 继续运行 (C) / 保存并退出 (s) / 不保存退出 (w): ') if input('[????] 是否保存到文件?确定 (y) / 取消 (N): ') in ['Y', 'y']:
if key in ['W', 'w']: return 0 try:
elif key in ['S', 's']: break print(f'[信息] 正在写入文件:{filepath}')
else: continue pandas.DataFrame.from_dict(data).to_excel(filepath, index=False, sheet_name='Sheet1')
except Exception as e:
print(f'[警告] 写入文件时发生了错误:{e}')
print(f'[信息] 正在写入文件:{filepath}') if input('[????] 继续运行 (C) / 退出程序 (w): ') in ['W', 'w']: break
try: else: continue
pandas.DataFrame.from_dict(data).to_excel(filepath, index=False, sheet_name='Sheet1')
except Exception as e:
print(f'[警告] 写入文件时发生了错误:{e}')
return 6
return 0 return 0