以下示例是关于Python中包含#读取JSON文件,并以JSON格式打印文件内容.用法的示例代码,想了解#读取JSON文件,并以JSON格式打印文件内容.的具体用法?#读取JSON文件,并以JSON格式打印文件内容.怎么用?#读取JSON文件,并以JSON格式打印文件内容.使用的例子?那么可以参考以下相关源代码片段来学习它的具体使用方法。
# read the JSON file and also print the file content in JSON format.
with open(filename, 'r') as f:
d = json.load(f)
print(json.dumps(d, indent=2))
本文地址:https://itbaoku.cn/snippets/872496.html