How to parsing a sequence of integers
bruno.42.desthuilliers at websiteburo.invalid
Fri Dec 19 15:02:56 CET 2008
John Machin a écrit :
> On Dec 20, 12:33 am, Bruno Desthuilliers <bruno.
> 42.desthuilli... at websiteburo.invalid> wrote:
>> Steven Woody a écrit :> Hi,
>>> I am a newbie and is reading the python book. Could anyone tell me,
>>> how to parsing the following string
>>> "123 100 12 37 ..."
>> > into a list of integers on which I can then apply max()/min()?
>> source = "123 100 12 37"
>> list_of_ints = [int(part) for part in source.strip().split()]
> The purpose of the .strip() would be ...?
Err... To check if you were paying attention ?-)
More information about the Python-list