_common.py 文件源码

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

项目:Dshield 作者: ywjt 项目源码 文件源码
def tzname_in_python2(namefunc):
    """Change unicode output into bytestrings in Python 2

    tzname() API changed in Python 3. It used to return bytes, but was changed
    to unicode strings
    """
    def adjust_encoding(*args, **kwargs):
        name = namefunc(*args, **kwargs)
        if name is not None and not PY3:
            name = name.encode()

        return name

    return adjust_encoding


# The following is adapted from Alexander Belopolsky's tz library
# https://github.com/abalkin/tz
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号