Python_Gmail

準備 啓用兩步驗證 創建程式密碼 授權外部訪問 Google Account。 發送電子郵件 發送文本電子郵件 import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText username = "@gmail.com" password = "password" mail_from = "@gmail.com" mail_to = "@gmail.com" mail_subject = "Test Subject" mail_body

Heroku_flask_搭建與使用

Install heroku CLI sudo snap install heroku --classic setup account heroku login Create app heroku create Create a new Git repository cd my-project/ git init heroku git:remote -a name Existing Git repository heroku git:remote -a name FLASK DEMO app.py from flask import Flask app = Flask(__name__) @app.route("/who") def who_am_i(): return "w0x7ce" if __name__ == '__main__': app.run(port=5000) wsgi.py from app import app if __name__ == "__main__": app.run() Procfile web: gunicorn wsgi:app

GCP Python_Flask搭建与使用

GCP Python 文檔 官方資料 Demo Installing the gcloud CLI Download #x86_64 curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-382.0.0-linux-x86_64.tar.gz #arm64 curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-382.0.0-linux-arm.tar.gz #x86 curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-382.0.0-linux-x86.tar.gz tar -xf google-cloud-*.tar.gz ./google-cloud-sdk/install.sh Initialize the gcloud CLI Run gcloud init: gcloud init If you are in a remote terminal session, you can use the –console-only flag to prevent the command from launching a browser-based authorization flow, if required: gcloud init --console-only Demo Deploy

QT5模板庫(一)

字符串類 操作字符串 basic QString str1 = "a"; QString str2 = "b"; QString str = str1 + str2; append QString str1 = "Welcome"; QString str2 = "to"; str1.append(str2); str1.append(" you! "); sprintf Qstring str; str.sprintf("%s", "Welcome"); str.sprintf("%s %s", "Welcome","to you"); %n QString str; str=QString("%1 was born in %2.").arg("Bob").arg(1998); others insert() 特定位置插入字符串 prepend() 開頭插入

機器學習 Pytorch完成股價預測

环境配置 import torch from torch import nn from torch.utils.data import DataLoader from torchvision import datasets from torchvision.transforms import ToTensor from torch.autograd import Variable 数据准备 df = pro.daily(ts_code='000001.SZ', start_date='20220101', end_date='20220326') df['date'] = pd.to_datetime(df['trade_date']) df['adj_close'] = df['close'] df['volume']=df['vol'] df['month'] = pd.DatetimeIndex(df['trade_date']).month df = df[['date','open','high','low','close','adj_close','volume','month']] print(df.head()) import numpy as np # x = torch.unsqueeze(torch.linspace(-1,1,100),dim=1) # y = x.pow(4)+0.1*torch.randn(x.size()) x_data = torch.unsqueeze(torch.tensor(df['high'].astype(np.float32).values),dim=1) x = (x_data-x_data.min())/(x_data.max()-x_data.min()) y_data = torch.unsqueeze(torch.tensor(df['close'].astype(np.float32).values),dim=1)