Use json.dumps to print

This commit is contained in:
Neil Booth 2016-11-14 07:54:59 +09:00
parent 6849937628
commit a22a4650a5

View File

@ -13,7 +13,6 @@
import argparse import argparse
import asyncio import asyncio
import json import json
import pprint
from functools import partial from functools import partial
from os import environ from os import environ
@ -67,7 +66,7 @@ class RPCClient(asyncio.Protocol):
'{:,d}'.format(error_count), '{:,d}'.format(error_count),
time_fmt(time))) time_fmt(time)))
else: else:
pprint.pprint(result, indent=4) print(json.dumps(result, indent=4, sort_keys=True))
def main(): def main():
'''Send the RPC command to the server and print the result.''' '''Send the RPC command to the server and print the result.'''