python - Split or Extract Strings into Arguments of Function? -
lets have function takes string arguments. want dynamically generate them. there not seem way plug in easily. how done? see example here
i_take_strings('one', 'two', 'and_the_letter_c') s = 'one 2 and_the_letter_c' i_take_strings(x x in s.split()) #python thinks i'm retarded attempt
s.split()
returns list can pass function variable arguments
prepending *
follows:
i_take_strings(*s.split())
Comments
Post a Comment