file_Utils.py 文件源码

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

项目:warriorframework 作者: warriorframework 项目源码 文件源码
def read(fd, **kwargs):
    """
    Reads at most size bytes from the file (less if the read hits EOF before
    obtaining size bytes).
    :Arguments:
        fd - file descriptor got from open_file
    :Optional:
        size - number of bytes to be read
    :Return:
        the string read from the file, None if not able to read
    """
    try:
        readsize = fd.read(**kwargs)
        print_info("read {} bytes from file {}".format(readsize, fd.name))
    except ValueError:
        print_error("file is already closed...")
        readsize = 0
    except Exception as e:
        print_error("found exception {} while reading {}".format(str(e), fd))
        readsize = 0
    return readsize
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号