path.py 文件源码

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

项目:EMFT 作者: 132nd-etcher 项目源码 文件源码
def crc32(self):

        if not self.isfile():
            raise TypeError('cannot compute crc32, not a file: {}'.format(self.abspath()))

        else:

            try:

                with open(self.abspath(), 'rb') as buf:
                    buf = "%08X" % (binascii.crc32(buf.read()) & 0xFFFFFFFF)

                    return buf

            except FileNotFoundError:
                raise FileNotFoundError('failed to compute crc32 for: {}'.format(self.abspath()))

            except PermissionError:
                raise PermissionError('failed to compute crc32 for: {}'.format(self.abspath()))

            except:
                raise RuntimeError('failed to compute crc32 for: {}'.format(self.abspath()))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号