日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

python修改json文件的value

系統 4179 0

#!/usr/bin/python
# coding=utf-8
import sys
import json
import argparse
reload(sys)
sys.setdefaultencoding('utf-8')

def PrepareParser():
? ? result=argparse.ArgumentParser(description="get data from jenkins")
? ? result.add_argument("-jf","--jsonfile",help="jsonfile", required=True)
? ? result.add_argument("-p","--platform",help="platform", required=True)
? ? result.add_argument("-v","--app_version",help="app_version", required=True)
? ? print result
? ? return result
parser=PrepareParser()
args=parser.parse_args()
json_file=args.jsonfile
platform=args.platform
app_version=args.app_version


with open(json_file, 'rb') as f:
? ? json_data = json.load(f)
? ? for item in json_data:
? ? ? ? if item["platform"]==platform:
? ? ? ? ? ? item["ver"] = app_version
? ? ? ? out = file(json_file, 'w+')
? ? ? ? reContent = json.dump(json_data, out, ensure_ascii=False, indent=4)


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦?。?!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 剑川县| 石嘴山市| 黄陵县| 汉源县| 宜良县| 紫阳县| 如皋市| 德昌县| 漠河县| 宜兰县| 灵川县| 北安市| 泽普县| 鄱阳县| 松桃| 宿州市| 哈巴河县| 永安市| 紫金县| 崇文区| 镇平县| 措勤县| 法库县| 岑溪市| 藁城市| 江西省| 开远市| 玛多县| 观塘区| 依兰县| 盖州市| 长垣县| 贵州省| 襄城县| 永春县| 长治市| 金平| 新密市| 固镇县| 方山县| 平乡县|