From D

Tim Williams tim at tdw.net
Thu Jul 26 19:26:23 EDT 2007


On 26/07/07, mensanator at aol.com <mensanator at aol.com> wrote:

>> 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

....but it doesn't if you use replace !!   <wink>

>>> z = '123 456'
>>> int( z.replace( ' ' ,'' ) )
> 123456


> Propose:
> 123 456 789 => 123456789
> 123.456 789 => 123.456789

+1 for me too

-- 

Tim Williams



More information about the Python-list mailing list