I am just learning Python. I am trying to create a list of empty lists: [[], [], [], ...] (10 items total).
What is the most Pythonic way to do this? If I use a list comprehension (as in myList = [[] for item in xrange (0, 10)]), Netbeans warns me that 'item' is never used. If I use a for-loop (as in for item in myList = []; for item in xrange (0, 10): myList.append([])), Netbeans still warns me of the same thing. If I use '*' (as myList = [[]] * 10), all of the empty lists refer to the same object; changing one changes them all. Do I have to live with the warning, or is there a "better" way? Thanks. -- http://mail.python.org/mailman/listinfo/python-list