Skip to Content
Python数据处理
book

Python数据处理

by Jacqueline Kazil, Katharine Jarmul
July 2017
Intermediate to advanced
398 pages
11h 54m
Chinese
Posts & Telecom Press
Content preview from Python数据处理
322
14
14.8.2
 添加自动化信息
发送报告、跟踪脚本、通知自己错误的一个简单方式是使用邮件或者其他直接从脚本发送
的信息。有很多
Python
库能帮助完成这个任务。精确地确定脚本和项目中需要什么类型的
信息是一个好的开始。
问问自己下列选项是否适用于你的脚本。
它会产生一个报告,并将报告发送到特定的收件人列表。
它有一个清晰的成功
/
失败信息。
它与其他的合作者或同事相关。
它提供了不易在网站或快速指示板上查看的结果。
如果这其中的任何一个听起来像你的项目,你的项目很可能适合某种方式的信息自动化。
1.
邮件
使用
Python
处理邮件非常直观。建议你通过你最喜欢的邮件提供商(我们使用
Gmail
),
构建一个独立的脚本的
email
地址。如果它没有立即自动同
Python
集成,很可能能够通过
在网上搜索发现合适的配置列表和有用的示例配置。
让我们看一下曾用来发送带有附件的邮件到收件人列表的脚本。我们修改了
@dbieber
写的代码片段(
https://gist.github.com/dbieber/5146518
),这段代码修改自
Rodrigo Coutinho
的博文“使用
Python
发送
Gmail
邮件”(
http://kutuma.blogspot.jp/2007/08/sending-emails-
via-gmail-with-python.html
):
#!/usr/bin/python
# Adapted from
# http://kutuma.blogspot.com/2007/08/sending-emails-via-gmail-with-python.html ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

数据科学中的实用统计学(第2版)

数据科学中的实用统计学(第2版)

Peter Bruce, Andrew Bruce, Peter Gedeck
Java持续交付

Java持续交付

Daniel Bryant, Abraham Marín-Pérez
解密金融数据

解密金融数据

Justin Pauley

Publisher Resources

ISBN: 9787115459190