Quickest way to build a long string?

Janko Hauser jhauser at ifm.uni-kiel.de
Thu Oct 12 11:32:04 EDT 2000


I have just tested the usage of cStringIO.StringIO() against the list
approach and the list approach is the clear winner, especially with
longer loops, eg. more lines to append.

As surprising as this seems, so list.append() is the best way to go.

HTH,
__Janko

-- 
  Institut fuer Meereskunde             phone: 49-431-597 3989
  Dept. Theoretical Oceanography        fax  : 49-431-565876
  Duesternbrooker Weg 20                email: jhauser at ifm.uni-kiel.de
  24105 Kiel, Germany



More information about the Python-list mailing list