main.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:jsoncsv 作者: alingse 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号