shutil module

# #Copy the contents of a file to another file 
shutil.copyfileobj(open( " file_1.txt " , " r " ,encoding= " utf-8 " ),open( " file_2.txt " , " w " ,encoding = " utf-8 " ))
# #Copy the contents of one file to another 
shutil.copyfile( " file_1.txt " , " flie_3.xtx " )

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324975864&siteId=291194637