util.py 文件源码

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

项目:llk 作者: Tycx2ry 项目源码 文件源码
def u(s):
        """Generate Unicode string from a string input, encoding Unicode characters.

        This is expected to work in the same way as u'<string>' would work in Python
        2.x (although it is not completely robust as it is based on a simple set of
        regexps).
        """
        us = re.sub(_U16_RE, lambda m: unichr(int(m.group('hexval'), 16)), unicode(s))
        us = re.sub(_U32_RE, lambda m: unichr(int(m.group('hexval'), 16)), us)
        us = re.sub(_UNAME_RE, lambda m: unicodedata.lookup(m.group('name')), us)
        return us
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号