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

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -