Read the contents of a file - reading a binary file, and then save the file to another

The following two methods can read and save a picture to another place 


F = Open ( ' C: \\ the Users del \\ \\ \\ 123.gif Desktop ' , ' RB ' ) s = f.read() f.close() Open with ( ' C: \\ the Users del \\ \\ \\ Desktop 1.png new folder \\ ' , ' WB ' ) AS F: f.write(s)



==================================================================================

f = open('C:\\Users\\del\\Desktop\\123.gif','rb')

s = f.read()

f.close()

x = open('C:\\Users\\del\\Desktop\\新建文件夹\\1.png','wb')
x.write(s)


 

Guess you like

Origin www.cnblogs.com/xiaobaibailongma/p/12375532.html