python - how to save a value from cgi.parse_multipart -


here code.

query = cgi.parse_multipart(rfile, pdict) upfilecontent = query.get('file') 

here, want save upfilecontent[0] file in binary mode.

tia

since value str, have open file in binary mode , .write() it:

with file('name.bin', 'wb') f: # 'w' writing, 'b' binary     f.write(d['key_1']) 

if wanted re-interpret text being kind of hex dump, or else, you'll have more specific.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -