Open rainit2006 opened 7 years ago
数据分析的应用实例
一个韭菜用Python采集,清洗和分析中证指数 https://zhuanlan.zhihu.com/p/27066919
日本株式のデータをスクレイピングなしで取得・リストにしたい https://qiita.com/Kuma_T/items/911b5201c9313717ab50
通过Python提取网页实时汇率 https://www.zhihu.com/question/52679464
如果日元汇率超过6就发邮件通知
# -*- coding: utf-8 -*-
import re import requests import smtplib from email.mime.text import MIMEText
class Mailer: def init(self, addr_to, subject, body): self.password = '' self.addr_from = 'xxxx@gmail.com' self.addr_to = addr_to self.charset = "ISO-2022-JP" self.subject = subject self.body = body
def send(self):
msg = MIMEText(self.body.encode(self.charset),'plain', self.charset)
msg['Subject']=self.subject
msg['From'] = self.addr_from
msg['To'] = self.addr_to
smtp=smtplib.SMTP('smtp.gmail.com', 587)
smtp.ehlo()
smtp.starttls()
smtp.ehlo()
smtp.login(self.addr_from, self.password)
smtp.send_message(msg)
smtp.close()
def send_email(value): email_body="""Japanses rate is now at {}""".format(value)
addr_to = 'xxxx'
subject = "japanses rate notification"
mailer = Mailer(addr_to, subject, email_body)
mailer.send()
url = 'http://www.boc.cn/sourcedb/whpj/index.html' # 网址 html = requests.get(url).content.decode('utf8') # 获取网页源码(中间涉及到编码问题,这是个大坑,你得自己摸索)
a = html.index(r'
if result[0] is not None: with open(r'汇率.txt', 'w+', encoding='utf8') as f: f.write(result[0] + '\n') f.write(r'现汇买入价:' + result[1] + '\n') f.write(r'现钞买入价:' + result[2] + '\n') f.write(r'现汇卖出价:' + result[3] + '\n') f.write(r'现钞卖出价:' + result[4] + '\n') f.write(r'中行折算价:' + result[5] + '\n') f.write(r'发布时间:' + result[6] + result[7] + '\n')
if float(result[3]) > 6: send_email(result[3])
为了让你的Google账号可以通过程序的方式发送email,需要事先设定“安全性の低いアプリへのアクセスを許可”。
![image](https://user-images.githubusercontent.com/12871721/33940675-40af8694-e053-11e7-9d51-011640880071.png)
圆周率里包含你的银行卡密码吗? https://www.zhihu.com/question/23419402/answer/327661779
搜索圆周率的网页 http://www.angio.net/pi/bigpi.cgi
python调用echart交互式可视化 https://blog.csdn.net/sunchengquan/article/details/79438730
Matplotlib plots can be included in a PyQt5 application. https://pythonspot.com/en/pyqt5-matplotlib/
pandasでピボットテーブルを扱う https://tigawa.github.io/blog/2016/07/16/pivot/
数値計算用の(自分用の)GUIツールを作る: PyQt http://hope-is-dream.hatenablog.com/entry/2015/01/24/143402
Excelで佐々木希を描く with python http://qiita.com/Algebra_nobu/items/4e2b36bdb38434e183de
10分で完了!PythonでGmailの一斉送信をしよう! http://play.kikagaku.co.jp/python/python-gmail-sending/
编程教室实验室 http://lab.crossincode.com/