R
Roel Schroeven
Stefan said:Nick said:data = [['foo','bar','baz'],['my','your'],['holy','grail']]
result = []
for d in data:
.>>> data = [['foo','bar','baz'],['my','your'],['holy','grail']]
.>>> from itertools import chain
.>>> result = "".join(chain(*data))
'foobarbazmyyourholygrail'
This is the first time I see that and I totally like the idea of writing
".>>>" instead of ">>>" at the beginning of a line. Thank you Dr. Dobb!
It's unfortunate for c.l.py that Python uses ">>>" as the default prompt
as it messes up the display on mail/news readers that provide "syntax
highlighting" for quotes.
Off topic, but indeed: I use Quote Colors in Mozilla which is very nice
for reading mails or news posts with quotes, but it's very confusing
with Python's prompt.
Prepending every line with . is not an ideal solution though... I think
it gets tiresome very quickly.