Read / Write image file

Max M maxm at mxm.dk
Tue May 3 14:57:47 EDT 2005


codecraig wrote:
> I have a image file on my pc, say a .jpg.  Basically I want to setup a
> client/server socket, and I want the client to read in the jpg and send
> it to the server, where the server can write that data into a new file
> on the server.
> 
> I tried just doing something like..
> 
> x = open("abc.jpg")
> y = x.read()
> tmp = open("newFile.jpg", "w")
> tmp.write(y)
> tmp.close()
> x.close()
> 
> ...but that doesn't give me a copy of abc.jpg
> 
> any ideas?  Thanks
> 

x = open("abc.jpg", 'rb')

-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science



More information about the Python-list mailing list