問題:在用python做自動化測試時,將html測試報告在郵件中添加文件發送的過程中,發現發送成功后,文件的后綴為.bin
解決方法:
加一行代碼
msg_att["Content-Disposition"] = 'attachment; filename="' + filename
順便分享一下fiename的命名
now_time = time.strftime('%Y-%m-%d %H:%M:%S') filename = 'report'+now_time+'.html'
問題:在用python做自動化測試時,將html測試報告在郵件中添加文件發送的過程中,發現發送成功后,文件的后綴為.bin
解決方法:
加一行代碼
msg_att["Content-Disposition"] = 'attachment; filename="' + filename
順便分享一下fiename的命名
now_time = time.strftime('%Y-%m-%d %H:%M:%S') filename = 'report'+now_time+'.html'
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。