uu_codec.py 文件源码

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

项目:news-for-good 作者: thecodinghub 项目源码 文件源码
def uu_encode(input, errors='strict', filename='<data>', mode=0o666):
    assert errors == 'strict'
    infile = BytesIO(input)
    outfile = BytesIO()
    read = infile.read
    write = outfile.write

    # Encode
    write(('begin %o %s\n' % (mode & 0o777, filename)).encode('ascii'))
    chunk = read(45)
    while chunk:
        write(binascii.b2a_uu(chunk))
        chunk = read(45)
    write(b' \nend\n')

    return (outfile.getvalue(), len(input))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号