0
我正在使用Python進行文本處理,其中我正在控制檯日誌中查找特定文本並打印每條匹配的行。這是通過調用函數來完成:收集Python輸出直到當前執行並將其分配給發送電子郵件的變量
get_matched_log_lines(url, search_pattern, print_pattern)
其中url
=從中我得到我的日誌,search_pattern
=我的目標搜索模式,print_pattern
=我想打印我的輸出(它,%s.%s
)
怎樣的方式我是否通過電子郵件發送功能get_matched_log_lines()
的整個輸出?電子郵件功能代碼已經由我在Python中編寫。
這是我覺得/迄今爲止嘗試:
email_content = get_matched_log_lines(url, search_pattern, print_pattern)
TO = 'recipient email address'
FROM ='sender email address'
#emailing function - py_mail
py_mail("Test email subject", email_content, TO, FROM)
這爲我提供了一個空的電子郵件。
而你的問題是什麼? – PyNEwbie
我剛剛編輯我的問題問...如何通過電子郵件發送函數get_matched_log_lines()的整個輸出?我希望現在更清楚。 –
[如何用Python發送電子郵件?]可能的副本(http://stackoverflow.com/questions/6270782/how-to-send-an-email-with-python) – PyNEwbie