103_勞保投保薪資分級表

題目說明:

請開啟PYD01.py檔案,依下列題意進行作答,使輸出值符合題意要求。作答完成請另存新檔為PYA01.py再進行評分。

程式所產出的檔案,須輸出與程式同一層資料夾。

設計說明:

請撰寫一程式,讀取勞保投保薪資分級表read.json內的資料後,將資料轉存為write.yaml。

輸入輸出:

輸入說明

讀取read.jason

輸出說明

將資料輸出至write.yaml

輸入輸出範例:

範例輸入_1

範例輸出_1

 

1637815898346

待編修檔案:

# 載入 yaml 與 json 模組
import ___
import ___

# 讀取 json 檔案
with ___("___", encoding='utf-8-sig') as file:
    data = ___.___(___)

# 寫入 yaml 檔案
with ___("___", "___", encoding="utf-8") as f:
    ___.___(data, f, default_flow_style=False, allow_unicode=True)

程式碼_1:

# 載入 yaml 與 json 模組
import yaml
import json

# 讀取 json 檔案
with open("./read.json", encoding='utf-8-sig') as file:
    data = json.load(file)

# 寫入 yaml 檔案
with open("./write.yaml", "w", encoding="utf-8") as f:
    yaml.dump(data, f, default_flow_style=False, allow_unicode=True)

程式碼_2:

# 載入 yaml 與 json 模組
import yaml
import json

# 讀取 json 檔案
with open("read.json", encoding='utf-8') as file:
    data = json.load(file)

# 寫入 yaml 檔案
with open("./write.yaml", "w", encoding="utf-8") as f:
    yaml.dump(data, f, default_flow_style=False, allow_unicode=True)


 搭 配 學 習 

  • Python 3.x 網頁資料擷取與分析特訓教材風_碁峰

    博客來      誠品

  • TQC+ Python 3.x網頁資料擷取與分析特訓教材_全華

    博客來      誠品

 

arrow
arrow

    DING BANG 發表在 痞客邦 留言(0) 人氣()