def export(objlist, outfile=None): if outfile is None: outfile = tempcsv() with open(outfile, 'wb') as csvobj: f = csv.writer(csvobj, delimiter=' ', quotechar='|', quoting=csv.QUOTE_MINIMAL) for im in objlist: f.writerow(im.export()); return outfile