Ok... I know pretty much how .extend works on a list... basically it
just tacks the second list to the first list... like so:
lista=[1]
listb=[2,3]
lista.extend(listb)
print lista;
[1, 2, 3]
what I'm confused on is why this returns None:
lista=[1]
listb=[2,3]
print lista.extend(listb)
J a écrit :
Ok... I know pretty much how .extend works on a list... basically it
just tacks the second list to the first list... like so:
lista=[1]
listb=[2,3]
lista.extend(listb)
print lista;
[1, 2, 3]
what I'm confused on is why this returns None:
So why the None? Is this because what's
On 04/16/10 23:41, J wrote:
Ok... I know pretty much how .extend works on a list... basically it
just tacks the second list to the first list... like so:
lista=[1]
listb=[2,3]
lista.extend(listb)
print lista;
[1, 2, 3]
what I'm confused on is why this returns None:
lista=[1]
On Sat, 2010-04-17 at 00:37 +1000, Lie Ryan wrote:
On 04/16/10 23:41, J wrote:
So, what I'm curious about, is there a list comprehension or other
means to reduce that to a single line?
from itertools import chain
def printout(*info):
print '\n'.join(map(str, chain(*info)))
or
On 4/16/2010 9:41 AM, J wrote:
Ok... I know pretty much how .extend works on a list... basically it
just tacks the second list to the first list... like so:
lista=[1]
listb=[2,3]
lista.extend(listb)
print lista;
[1, 2, 3]
This shows right here that lista is extended in place. If you are not
On Fri, Apr 16, 2010 at 15:16, Terry Reedy tjre...@udel.edu wrote:
On 4/16/2010 9:41 AM, J wrote:
Ok... I know pretty much how .extend works on a list... basically it
just tacks the second list to the first list... like so:
lista=[1]
listb=[2,3]
lista.extend(listb)
print lista;
[1, 2,