How to save a binary file?

Jonas H. jonas at lophus.org
Tue Oct 5 18:18:11 EDT 2010


On 10/05/2010 11:11 PM, hidura at gmail.com wrote:
> Hello, how i can save a binary file, i read in the manual in the IO area
> but doesn' t show how to save it.
> Here is the code what i am using:
> s = open('/home/hidura/test.jpeg', 'wb')
> s.write(str.encode(formFields[5]))
> s.close()

So where's the problem? That code should work. Anyway, you want to have 
a look at with-statements.

Jonas



More information about the Python-list mailing list