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

python修改json文件的value

系統 4480 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條評論
主站蜘蛛池模板: 集安市| 临潭县| 西乌| 巴东县| 黄山市| 图木舒克市| 阳信县| 沧源| 喀喇| 水城县| 西和县| 潼关县| 子长县| 安吉县| 观塘区| 潞西市| 高青县| 佛学| 漠河县| 长汀县| 固原市| 克东县| 自贡市| 积石山| 乌鲁木齐县| 文成县| 锦屏县| 无极县| 朝阳区| 江源县| 漾濞| 安塞县| 华宁县| 封开县| 柳江县| 岢岚县| 惠水县| 河南省| 塔城市| 瑞丽市| 深泽县|