主题:Python文件复制中如何复制相关文件的实际
用Python文件复制相关文件时,我们就可以使用shutil模块对其进行复制,在Python文件复制的时,你如果对其有不解之处,你就可以通过以下的对Python文件复制的相关实际操作的相关方案有所了解。
Python文件复制与重命名当我们要复制文件的时候,可以使用shutil模块:
						
					Python文件复制与重命名当我们要复制文件的时候,可以使用shutil模块:
- 
		shutil.copy(myfile, tmpfile)  
 
import shutil
- 
		shutil.copy2(myfile, tmpfile) 
 
- 
		shutil.copytree(root_of_tree, destination_dir, True) 
 
- 
		cp ../../f1.c . 
 
- 
		shutil.copy(os.path.join(os.pardir,os.pardir,’f1.c’), os.curdir) 
 
- 
		os.rename(myfile, ’tmp.1’)  
 
- 
		os.rename(myfile, os.path.join(d, myfile)) 
 
- 
		os.remove(myfile)  
 
shutil.copy2(myfile, os.path.join(d, myfile))
- 
		copymode(sor,sten) 
 

 您所在位置:
 您所在位置: