在 Python 中存储 return 打印 Whois 数据
Storing return data of print Whois in Python
我有这个 Python 脚本:
import whois
w = whois.whois('google.com')
print w
我想存储打印结果以通过电子邮件发送。
您已经将结果存储在 w
中。
下载 yagmail 让您发送电子邮件变得更轻松。
运行 在命令行上 pip install yagmail
接下来,您可以轻松地向自己发送一封电子邮件,例如:
import yagmail
import whois
w = whois.whois('google.com')
yag = yagmail.SMTP('yourusername@gmail.com', 'yourpasswrd')
yag.send(contents = str(w))
请注意,默认情况下是在没有 to
参数的情况下发送给自己。
如果你想明确你可以这样做:
yag.send('recipient@email.com', "this is the subject", str(w))
我有这个 Python 脚本:
import whois
w = whois.whois('google.com')
print w
我想存储打印结果以通过电子邮件发送。
您已经将结果存储在 w
中。
下载 yagmail 让您发送电子邮件变得更轻松。
运行 在命令行上 pip install yagmail
接下来,您可以轻松地向自己发送一封电子邮件,例如:
import yagmail
import whois
w = whois.whois('google.com')
yag = yagmail.SMTP('yourusername@gmail.com', 'yourpasswrd')
yag.send(contents = str(w))
请注意,默认情况下是在没有 to
参数的情况下发送给自己。
如果你想明确你可以这样做:
yag.send('recipient@email.com', "this is the subject", str(w))