B
Bruno Desthuilliers
Mike Kent wrote:
(snip)
Yes it does:
Plain wrong.
Plain wrong.
Plain wrong again. list.append() returns None, so the following code:
- retrieve a reference to p[j] (which happens to be a list)
- append something to that list
- then rebind p[j] to None...
Indeed. One could even say "broken" and "braindead".
Given your obvious lack of even the most basic knowledge concerning
Python, it would be better for you *and everyone reading this newsgroup*
that you take time to actually test before posting.
(snip)
p[j] does not give you a reference to an element inside p.
Yes it does:
a = ['a']
b = ['b']
c = ['c']
p = [a, b, c]
p[0] is a True
p[1] is b True
p[2] is c True
p[0].append('z')
a ['a', 'z']
It gives
you a new sublist containing one element from p.
Plain wrong.
You then append a
column to that sublist. Then, since you do nothing more with that
sublist, YOU THROW IT AWAY.
Plain wrong.
Try doing:
p[j] = p[j].append(col)
Plain wrong again. list.append() returns None, so the following code:
- retrieve a reference to p[j] (which happens to be a list)
- append something to that list
- then rebind p[j] to None...
However, this will still result in inefficient code.
Indeed. One could even say "broken" and "braindead".
Since every line
you read in via the csv reader is already a list, try this (untested)
Given your obvious lack of even the most basic knowledge concerning
Python, it would be better for you *and everyone reading this newsgroup*
that you take time to actually test before posting.