def jsoncsv(output, input, expand_, restore_, safe, separator):
if expand_ and restore_:
raise click.UsageError('can not choose both, default is `-e`')
func = expand
if restore_:
func = restore
for line in input:
obj = json.loads(line)
new = func(obj, separator=separator, safe=safe)
content = json.dumps(new, ensure_ascii=False).encode('utf-8')
output.write(content)
output.write('\n')
input.close()
output.close()
评论列表
文章目录