python unicode to str and str to unicode

    @staticmethod
    def unicode2str(p_unicode):
        v = p_unicode.encode('unicode-escape').decode('string_escape') if p_unicode is not None else None
        return v

    @staticmethod
    def str2unicode(p_str):
        v = p_str.decode('unicode-escape') if p_str is not None else None
        return v

 

posted on 2018-04-27 18:09  星河赵  阅读(202)  评论(0编辑  收藏  举报

导航