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
Post a Comment