From D

mensanator at aol.com mensanator at aol.com
Thu Jul 26 20:10:41 CEST 2007


On Jul 26, 12:18 am, Ben Finney <bignose+hates-s... at benfinney.id.au>
wrote:
> "mensana... at aol.com" <mensana... at aol.com> writes:
> > IDLE 1.2c1
> > >>> s = '123 456'
> > >>> s.split()
> > ['123', '456']
>
> The str.split method has no bearing on this discussion,

It most certainly does. To make '123 456' into an integer,
you split it and then join it.
>>> z = '123 456'
>>> y = z.split()
>>> x = ''.join(y)
>>> w = int(x)
>>> w
123456

Just wanted to be sure that this must still be done explicitly
and that the language won't do it for me behind my back.

> which is about
> the Python language syntax,

Provided it is confined to the language syntax.

> and numeric literal values in particular.

Fine, as long as int('123 456') continues to be an error.

>
> --
>  \        "Pinky, are you pondering what I'm pondering?" "Wuh, I think |
>   `\    so, Brain, but burlap chafes me so."  -- _Pinky and The Brain_ |
> _o__)                                                                  |
> Ben Finney





More information about the Python-list mailing list