A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/084550.html below:

string concatentation

string concatentation string concatentationMarcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sun Apr 1 09:29:59 EDT 2001
Sun, 01 Apr 2001 12:21:00 GMT, Tony Rentschler <tonyr at walterr.bellatlantic.net> pisze:

> My first thought was to do something like this:
> big_string = big_string + new_string.
> 
> In practice, will this be inefficient?

Yes.

> That is, will Python malloc a new big_string each time I add a line?

Yes.

> Is there another way to handle this sort of situation,

Yes: e.g. append strings to a list and join them at the end
(using string.join or Python-2.0's ''.join(list)), or use the
cStringIO module.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4