Message152450
| Author |
drathlian |
| Recipients |
drathlian |
| Date |
2012年02月02日.00:40:48 |
| SpamBayes Score |
7.423281e-06 |
| Marked as misclassified |
No |
| Message-id |
<1328143249.02.0.799282824218.issue13925@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I might be missing something, but I am expecting the following code to print out a list of lists with each internal list holding one number[0-4], but instead the internal lists are a copy of the list "count".
#!/usr/bin/python
count = range(4)
twoDimensionList = [[]] * len(count)
for i in range(len(count)):
twoDimensionList[i].append(count[i])
print twoDimensionList
Should print:
[[0], [1], [2], [3]]
but erroneously prints:
[[0, 1, 2, 3], [0, 1, 2, 3], [0, 1, 2, 3], [0, 1, 2, 3]] |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年02月02日 00:40:49 | drathlian | set | recipients:
+ drathlian |
| 2012年02月02日 00:40:49 | drathlian | set | messageid: <1328143249.02.0.799282824218.issue13925@psf.upfronthosting.co.za> |
| 2012年02月02日 00:40:48 | drathlian | link | issue13925 messages |
| 2012年02月02日 00:40:48 | drathlian | create |
|