This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Tue May 12 02:46:22 2020 | |
| @author: Zino | |
| """ | |
| # 導入 模組(module) | |
| import requests | |
| # 把 到 ptt 八卦版 網址存到URL 變數中 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 導入 模組(module) | |
| import requests | |
| # 把 到 ptt 八卦版 網址存到URL 變數中 | |
| URL = "https://www.ptt.cc/bbs/Gossiping/index.html" | |
| # 發送get 請求 到 ptt 八卦版 | |
| response = requests.get(URL) | |
| # 印出回傳網頁程式碼 | |
| print(response.text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Mon May 4 01:59:51 2020 | |
| @author: Zino | |
| dataset:https://data.gov.tw/dataset/120711 | |
| """ | |
| # 導入模組(module) | |
| import requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import requests 套件包 | |
| import requests | |
| # GET請求抓資料 | |
| page = requests.get('https://www.google.com.tw/') | |
| #印出網頁程式碼 | |
| print(page.text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| import random, string | |
| def get_one_pagedata(i): | |
| ''' | |
| 假設這個function爬取某一網頁資料。 | |
| 先用亂數給予一個英文大小寫文字替代。 | |
| ''' | |
| content = random.choice(string.ascii_letters) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 將不同資料長度畫在不同的為度上 | |
| # ref https://matplotlib.org/examples/axes_grid/demo_parasite_axes2.html | |
| import matplotlib.pyplot as plt | |
| x_values1=[1,2,3,4,5] | |
| y_values1=[1,2,2,4,1] | |
| x_values2=[-1000,-800,-600,-400,-200,-100,0] | |
| y_values2=[10,20,39,40,50,60,10] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Sales | CompPrice | Income | Advertising | Population | Price | ShelveLoc | Age | Education | Urban | US | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 9.5 | 138 | 73 | 11 | 276 | 120 | Bad | 42 | 17 | Yes | Yes | |
| 2 | 11.22 | 111 | 48 | 16 | 260 | 83 | Good | 65 | 10 | Yes | Yes | |
| 3 | 10.06 | 113 | 35 | 10 | 269 | 80 | Medium | 59 | 12 | Yes | Yes | |
| 4 | 7.4 | 117 | 100 | 4 | 466 | 97 | Medium | 55 | 14 | Yes | Yes | |
| 5 | 4.15 | 141 | 64 | 3 | 340 | 128 | Bad | 38 | 13 | Yes | No |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Command: | |
| def redo(self, **kwargs): | |
| abstract | |
| def undo(self, **kwargs); | |
| abstract | |
| class UploadImgurCommand extend Command: | |
| def redo(self, **kwargs): | |
| image = kwargs['image']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Fri Jan 19 17:34:34 2018 | |
| 當遇到字串一樣時python 判別 | |
| @author: zino | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Tue Dec 26 16:18:35 2017 | |
| @author: zino | |
| """ | |
| from datetime import datetime | |
| import time |