Changing a Value in List of lists
Rishabh Dixit
rishabhdixit11 at gmail.com
Sun Sep 2 05:44:15 EDT 2012
More information about the Python-list mailing list
Sun Sep 2 05:44:15 EDT 2012
- Previous message (by thread): The method of insert doesn't work with nltk texts: AttributeError: 'ConcatenatedCorpusView' object has no attribute 'insert'
- Next message (by thread): Changing a Value in List of lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi all, I have a doubt regarding how the list work in following case- >>> ls=[[0]*5]*5 >>> ls[1][1]+=1 >>> ls [[0, 1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 1, 0, 0, 0]] Here, according to me only one value in ls should be incremented but it is increasing 1 value in all the lists of ls. Why?? -- Regards, Rishabh Dixit MSc.(Tech) Information Systems, BITS Pilani -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-list/attachments/20120902/b160646d/attachment.html>
- Previous message (by thread): The method of insert doesn't work with nltk texts: AttributeError: 'ConcatenatedCorpusView' object has no attribute 'insert'
- Next message (by thread): Changing a Value in List of lists
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list