Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Passing a second input to itertools deopwhile

This works

def doesnt_contain_character(str,sub):
    substring = sub
    if substring in str:
        return False
    else:
        return True

doesnt_contain_character('ipsum','a')

but this

string_list = ['lorem', 'ipsum', 'dolor', 'sit', 'amet']
print(list(it.dropwhile(doesnt_contain_character(str,'a'), string_list)))

not because I need to pass 'a'. In brief all exemple of dropwhile on the net doesn't need two inputs. Is there a way to do that ?