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