Turn off line wrap for lists?

Michael Tobis mtobis at gmail.com
Thu Jan 4 20:23:46 EST 2007


_ wrote:
> (I did google for this, I promise)
>
> How do I get python NOT to insert newlines into string representations
> of lists when I do something like this:
>
> strCollector += "%s" % (['a', 'list', 'with', 'lots', 'of', 'elements']
> * 100)

It shouldn't and doesn't insert newlines.

######
>>> strCollector = "%s" % (['a', 'list', 'with', 'lots', 'of', 'elements'] * 100)
>>> strCollector.split("\n")[0] == strCollector
True
######
mt




More information about the Python-list mailing list