utils.py 文件源码

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

项目:indy-plenum 作者: hyperledger 项目源码 文件源码
def isHex(val: str) -> bool:
    """
    Return whether the given str represents a hex value or not

    :param val: the string to check
    :return: whether the given str represents a hex value
    """
    if isinstance(val, bytes):
        # only decodes utf-8 string
        try:
            val = val.decode()
        except ValueError:
            return False
    return isinstance(val, str) and all(c in string.hexdigits for c in val)

# decorator
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号