file = zipfile.ZipFile( 'somezip.zip', "w") zip_file_internal_name = 'x.smt' file.writestr ( zip_xml_name, some_string_data ) file.close()