i have a list and i want to search for a certain string and replace it.

i think i got it now...

sbxe1 = list([['type','ter',[[[['lala']]]]],'name'])
def parsesb(lis, string, replacement):
        for num, nam in enumerate (lis):
                if type(nam) == list: 
                        parsesb(lis[num],string,replacement)
                if type(nam) == str: # do something
                        if nam == string: lis[num] = replacement
parsesb(sbxe1 ,'name', 'booooogyman')
print sbxe1             
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to