python test_optional_jsonfile.py
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python test_optional_jsonfile.py相关的知识,希望对你有一定的参考价值。
import json
from jsoncore import optional_jsonfile, indent_option, encoding_option
import click
def json_dump_settings(ctx, param, value):
indent = int(value)
return {
"indent": indent or None,
"separators": None if indent else (',', ':'),
"sort_keys": bool(indent)
}
@click.command()
@optional_jsonfile
@encoding_option
@indent_option
@click.version_option()
@click.pass_context
def jsontest(ctx, jsonfile, encoding, indent):
"""Concatenate JSON FILE(s), or standard input & format standard output."""
if jsonfile is None:
print('file not specified')
else:
print(json.dumps(jsonfile, **indent))
if __name__ == '__main__':
jsontest()
以上是关于python test_optional_jsonfile.py的主要内容,如果未能解决你的问题,请参考以下文章
Python代写,Python作业代写,代写Python,代做Python
Python开发
Python,python,python
Python 介绍
Python学习之认识python
python初识