Mar-07-2017, 04:18 PM
The code below works for the single line of code (#), but not when broken up into 3 different assignments (##). Where am I going wrong?
# ActivePython 2.7.10.12 on Windows 7 # want to create a list of lists # [["one","two","three"],["four","five","six"]] # out of the list all_entries # works for the single line of code (#), but # alternate code of individual indices (##) gives # [["four","five","six"],["four","five","six"]] all_entries = ["one","two","three","four","five","six"] bookmark_entry = [0] * 3 bookmark_list = [] limit = len(all_entries) for i in range(0,limit,3): print "i = :" + str(i) ### just for debugging purposes #bookmark_entry = [all_entries[i],all_entries[i + 1],all_entries[i + 2]] # as single line bookmark_entry[0] = all_entries[i] ## print bookmark_entry[0] bookmark_entry[1] = all_entries[i + 1] ## print bookmark_entry[1] bookmark_entry[2] = all_entries[i + 2] ## print bookmark_entry[2] bookmark_list.append(bookmark_entry) print "bookmark_entry" + str(bookmark_entry) print "bookmark list " + str(bookmark_list)