判断文件是否存在:
import os
if os.path.exists(f'{last_month}月凭证同步结果.xlsx'):
pass
pandas过滤txt
import pandas as pd
import os
import win32clipboard as w
df = df.iloc[:,0].apply(lambda x:x[5:] if'单据编号' in x else None )
df = df.dropna(axis=0,how='all')
df = df.to_list()
df = '\r\n'.join(df)
print(type(df))
w.OpenClipboard()
w.EmptyClipboard()
w.SetClipboardText(df)
w.CloseClipboard()
apply 遍历pandas https://www.jianshu.com/p/30e7c466eaba