send_text_example_prompt.py 文件源码

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

项目:yige-python 作者: wwj718 项目源码 文件源码
def output_format(obj):
    '''
    python2/3
    ???????
    obj is dict
    http://stackoverflow.com/questions/35950573/python-unicode-string-to-javascript
    '''
    formatted_json = json.dumps(obj, sort_keys=True, indent=4,ensure_ascii=False).encode('utf8')
    if (sys.version_info > (3, 0)):
            # Python 3 code in this block
            colorful_json = highlight(formatted_json, lexers.JsonLexer(), formatters.TerminalFormatter())
            return colorful_json
    else:
            colorful_json = highlight(unicode(formatted_json, 'UTF-8'), lexers.JsonLexer(), formatters.TerminalFormatter())
            return colorful_json #??????
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号