py2 json字符串转字典去掉前缀u

def unicode_convert(input):
    if isinstance(input, dict):
        return {unicode_convert(key): unicode_convert(value) for key, value in input.iteritems()}
    elif isinstance(input, list):
        return [unicode_convert(element) for element in input]
    elif isinstance(input, unicode):
        return input.encode('utf-8')
    else:
        return input

 

posted @ 2019-01-18 13:43  lvmenghui001  阅读(1074)  评论(0编辑  收藏  举报