Good Morning,
Given a string consisting of numbers separated by spaces such as '1234
5678 1 233 476'. I can see I have two obvious choices to extract or
parse out the numbers. The first relying on iteration so that as I
search for a blank, I build a substring of all characters found before
the space and then, once the space is found, I can then use the int(n)
function to determine the number. From my C++ background, that is the
approach that seems not only most natural but also most
efficient......but....the rules of Python are different and I easily see
that I can also search for the first blank, then using the character
count, I can use the slice operation to get the characters. Of even
further interest I see a string built-in function called split which, I
think, will return all the distinct character sub strings for me.
My question is what is the most correct python oriented solution for
extracting those substrings?
Thanks,
Robert Berman
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor