Possible Duplicate:
Python list confusion
This is a quiestion about list of python. (My programming environment is SL4A with python)
I want a list below with inputted number "n".
[ ['a'] , [] , [] , [] ] # (this example is the list when n =4) <- the list I want
So, I wrote a source-code below.
n = input()
array = [[]]*n
array[0].append('a')
print array
However, I can' get an output above, but also get a list as like...
[ ['a'], ['a'], ['a'], ['a'] ] # <- wrong list
So, I have two questions.
- Please tell me a source-code which is give me a list what I want.
- Why does the source-code give me the wrong list?