On Apr 21, 3:30 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > kevinliu23 a écrit :> Hey guys, > > > So I have a question regarding the split() function in the string > > module. Let's say I have an string... > > > input = "2b 3 4bx 5b 2c 4a 5a 6" > > projectOptions = (input.replace(" ", "")).split('2') Thanks for all your help everyone. :)
> The parens around the call to input.replace are useless: > projectOptions = input.replace(" ", "").split('2') > > > print projectOptions > > > ['', 'b34bx5b', 'c4a5a6'] > > (snip) > > > What can I do so that the first element is not an empty > > string? but the 'b34bx5b' string as I expected? > > projectOptions = filter(None, input.replace(" ", "").split('2')) -- http://mail.python.org/mailman/listinfo/python-list