The write accepts strings only, so you may do: out.write( repr(list(clean)) )
Notes: - If you need the strings in a nice order, you may sort them before saving them: out.write( repr(sorted(clean)) ) - If you need them in the original order you need a stable method, you can extract the relevant code from this large blob: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/438599 Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list