生活中的程式 - Python自動化 02 (課前準備)

Work with CSV files & JSON in Python

Pyladies Taiwan

Author : Olly
Speaker : Amber

2018/05/27

Book

Basic and Environment (請先安裝)

Requests Module

If you have native python you can install module as below :

pip install requests

If you use conda you can install module as below :

conda install requests

Check Modules Exist

You don't need to install csv and json, because they are in standard library.

Check Without Error Message!!

import csv
import json
import requests

If you can't install anyway...

repl.it frok 我的專案

  • 注意:
    • repl.it 會一次跑完整個指令
    • 要看變數內容必須 print() 出來

Prepare for Project

1. 申請帳號:

Enter OpenWeatherMap hit Sign Up

Create personal account

2. 取得 APPID

3. 用網頁查看 API

點擊連結,填入剛剛取得的 APPID:

http://api.openweathermap.org/data/2.5/weather?q=Taipei&APPID=填入剛剛取得的APPID

json 排版後: