简体   繁体   English

Python中的shutdownil模块中的shutil.move()方法

[英]shutil.move() method in shutil module in Python

Does shutil.move(src, dest) method call the os.system() method or the bash commands 'mv' and 'cp'? shutil.move(src,dest)方法是否调用os.system()方法或bash命令“ mv”和“ cp”?

PS : I searched on the net but couldn't find any helpful info. PS:我在网上搜索,但找不到任何有用的信息。

use the source Luke: 使用源码卢克:

http://hg.python.org/cpython/file/2.7/Lib/shutil.py http://hg.python.org/cpython/file/2.7/Lib/shutil.py

it actually does neither. 它实际上什么都不做。 if you follow the code, it ends up opening a new file descriptor and writing buffered bytes to it. 如果您遵循该代码,则最终将打开一个新的文件描述符并向其中写入缓冲的字节。 like this: 像这样:

while 1:
    buf = fsrc.read(length)
    if not buf:
        break
    fdst.write(buf)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM