Directories.py 文件源码

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

项目:enigma2 作者: Openeight 项目源码 文件源码
def copyfile(src, dst):
    try:
        f1 = open(src, "rb")
        if os.path.isdir(dst):
            dst = os.path.join(dst, os.path.basename(src))
        f2 = open(dst, "w+b")
        while True:
            buf = f1.read(16*1024)
            if not buf:
                break
            f2.write(buf)
        st = os.stat(src)
        mode = S_IMODE(st.st_mode)
        os.chmod(dst, mode)
        os.utime(dst, (st.st_atime, st.st_mtime))
    except:
        print "copy", src, "to", dst, "failed!"
        return -1
    return 0
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号