python3.6_发送邮件
#股票提醒系统import tushare import time import smtplib from email.mime.text import MIMETextdef getrealtimequotes(share):dataNow=tushare.get_realtime_quotes(share.code)share.name=dataNow.loc[0][0]share.price=float(dataNow.loc[0][3])share.high=dataNow.loc[0][4]share.low=dataNow.loc[0][5]share.openToday=dataNow.loc[0][1]share.pre_close=dataNow.loc[0][2]share.volume=dataNow.loc[0][8]share.amount=dataNow.loc[0][9]share.timee=dataNow.loc[0][30]share.describe='股票名'+share.name,'当前价格'+str(share.price)return share#发送邮件方法 def sendemail(subject,content):msg_from="hexiuxiu1@126.com" #发送方pwd='12344321a'#授权码to='744827389@qq.com'#subject='python邮件标题'#content='python邮件正文'#构造邮件msg=MIMEText(content)msg['Subject']=subjectmsg['From']=msg_frommsg['To']=to#发送邮件try:ss=smtplib.SMTP_SSL('smtp.126.com',465)#ss=smtplib.SMTP('localhost') ss.login(msg_from,pwd)ss.sendmail(msg_from,to,msg.as_string())print('发送成功')except Exception as e:print('发送失败')raise eclass Share():def __init__(self,code,buy,sale):self.name=""self.price=""self.high=""self.low=""self.openToday=""self.pre_close=""self.volume=""self.amount=""self.timee=""self.code=codeself.buy=buyself.sale=saledef main(sharelist):for share in sharelist:sss=getrealtimequotes(share)print(share.describe)if sss.price<=sss.buy:sendemail('股票购买通知','股票降价了,赶紧买')print('赶紧买!')elif sss.price>=sss.sale:sendemail('股票抛售通知','股票涨价了,赶紧卖')print('可以卖了!')else:print('待定......')while 1==1:share1=Share('000591',3.3,3.4)share2=Share('000591',3.3,3.4)share3=Share('000591',3.3,3.4)list1=[share1,share2,share3]main(list1)print('------------')time.sleep(10)
转载于:https://www.cnblogs.com/xiuxiu123456/p/10879785.html
python3.6_发送邮件相关推荐
- python3批量发送邮件
这次介绍运用python3批量发送邮件.使用这个功能,我们可以在爬虫中将程序遇到的问题发送到指定邮件,以便及时处理断掉的爬虫.在python中对发送邮件协议STMP的支持有两个模块:smtplib和e ...
- Python3 入门教程||Python3 SMTP发送邮件||Python3 多线程
Python3 SMTP发送邮件 在Python3 中应用的SMTP(Simple Mail Transfer Protocol)即简单邮件传输协议,它是一组用于由源地址到目的地址传送邮件的规则,由它 ...
- Python3.x 发送邮件
Python有两个包可以发送邮件:smtplib和email # - * - coding: utf - 8 -*- # # 作者:田丰 # 邮箱:fonttian@163.com # 撰写时间:20 ...
- Python语言程序设计之Python3 SMTP发送邮件
SMTP(Simple Mail Transfer Protocol)即简单邮件传输协议,它是一组用于由源地址到目的地址传送邮件的规则,由它来控制信件的中转方式. python的smtplib提供了一 ...
- spark python3.6_在mac上搭建spark+ipython环境
Big Data computing 下课之后回去试着搭建了一下spark环境,在这里记录安装过程中遇到的坑及解决方法和一些待解决的问题. mac上的python环境:Anaconda for pyt ...
- ubuntu安装python3.6_如何在Ubuntu19.04上安装Python3.6?
我最近安装了Ubuntu 19.04,默认为Python 3.7.我需要处理多个使用Python 3.6的项目. 有没有办法把它安装到迪斯科野狗上? 我试过了对16.04有效的方法milano@mil ...
- ubuntu python3.6_在 Ubuntu 16.04 LTS 系统上安装 Python 3.6
Ubuntu 16.04 LTS 系统默认自带的是 Python 2.7 和 Python 3.5,有时候我们会需要用到 Python 3.6,但是官方的源里是没有 Python 3.6 的 ,今天就 ...
- tensorflow python3.6_[教程]Tensorflow + win10 + CPU + Python3.6+ 安装教程
由于各种原因,清华镜像源已经彻底挂掉了,但是目前网上的各种教程基本上都是采取设置清华镜像源来加快下载速度,所以这给小白带来了很大的困扰!这里我将通过合理上网工具来直接下载源镜像. 注意:本次教程适用于 ...
- 编译安装python3.6_编译安装Python3.6及以上
编译安装Python3.6及以上 前言 系统环境为centos6或7系统,编译安装python3.6及以上版本需要带上ssl模块,否则后面pip3安装会出现ssl类似的报错.而3.6及以上中的ssl模 ...
- macos安装python3.6_在CentOS 7/Ubuntu 16.04/Debian 9/macOS上安装Python 3.6的方法
本文介绍在CentOS 7/Ubuntu 16.04/Debian 9/macOS操作系统上安装Python 3.6的方法,包括使用Python 3.6创建virtualenv,目前大多数Linux发 ...
最新文章
- 线性代数:04 特征值与特征向量 -- 特征值与特征向量
- 亿科影视管理系统1.2.0版以及1.0版本均有后门
- JVM:内存分配与回收策略?Full GC 的触发条件?StopTheWorld ?
- 自动转换开关(ATS)在数据中心配电系统中的应用
- framework7 1.3.5 路由跳转后DOM失效问题
- jsap支付_Java命令行界面(第20部分):JSAP
- C++中实现精度的控制和输出 showpoint<<或者fixed<<setprecision()用法
- 2016计算机二级考试c语言真题及答案,计算机二级考试c语言真题_2017计算机二级考试C语言复习题及答案...
- 《量子信息与量子计算简明教程》绪论
- android 自定义menu菜单按键功能
- 全国计算机三级网络技术感悟,这几天准备计算机三级考试的感悟
- php解决时间2038问题,PHP实例:关于PHP转换超过2038年日期出错的问题解决
- Python爬取全球是最大的电影数据库网站IMDb数据
- python符号积分
- 房天下全国658个城市新房,二手房爬取
- html表格固定首行首列
- 如何用ChatGPT做新品上市推广方案策划?
- 聊聊MySQL的10大经典错误
- Modifiers should be declared in the correct order 修饰符应按正确的顺序声明
- 史上最全JVM重点知识总结