第一期 Python 程式設計入門共學營作業任務十四


問題申論

JSON全名叫做JavaScript Object Notation,以純文字儲存及傳送的簡單結構化資料,用字串、數字、布林、陣列、物件或null儲存任何資料,陣列用list[],物件用dict{}。
python以json及pickle模組來讀取,如範例:

import json
test_dict = {'bigberg': [7600, {1: [['iPhone', 6300], ['Bike', 800], ['shirt', 300]]}]}
print(test_dict)
print(type(test_dict))
#dumps 將資料轉換成字串
json_str = json.dumps(test_dict)
print(json_str)
print(type(json_str))

程式實作

https://repl.it/@hufeigopython/basicpythonhw14

#第一期Python程式設計入門共學營






你可能感興趣的文章

React 部署上 Github pages

React 部署上 Github pages

ClearDB id 連續遞增問題

ClearDB id 連續遞增問題

Debounce & Throttle in React - 2

Debounce & Throttle in React - 2






留言討論