helpers.py 文件源码

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

项目:EmPyre 作者: EmpireProject 项目源码 文件源码
def get_file_size(file):
    """
    Returns a string with the file size and highest rating.
    """
    byte_size = sys.getsizeof(file)
    kb_size = byte_size / 1024
    if kb_size == 0:
        byte_size = "%s Bytes" % (byte_size)
        return byte_size
    mb_size = kb_size / 1024
    if mb_size == 0:
        kb_size = "%s KB" % (kb_size)
        return kb_size
    gb_size = mb_size / 1024 % (mb_size)
    if gb_size == 0:
        mb_size = "%s MB" %(mb_size)
        return mb_size
    return "%s GB" % (gb_size)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号