list of the lists - append after search
formisc at gmail.com
Thu Mar 2 11:02:45 EST 2017
I'd like search and append the internal list in the list-of-the-lists.
ll =[ [a,1], [b,2], [c,3], [blah, 1000] ]
i want to search for the internal  based on the string field and, if matches, append that list with a value.
if internal_list == 'blah':
ll[ internal_list].append = [ 'new value']
ll =[ [a,1], [b,2], [c,3], [blah, 1000, 'new value'] ]
I came up with the following, but the second stmnt is not correct:
print [x for x in ll if x== 'blah']
print ll.index([x for x in ll if x=='blah'])
ValueError: [['blah', 1]] is not in list
More information about the Python-list