A simple question string.replace

Emile van Sebille emile at fenx.com
Mon Jan 30 23:43:56 EST 2006


"Haibao Tang" <tanghaibao at gmail.com> wrote in message 
news:1138681387.207213.45940 at g49g2000cwa.googlegroups.com...
>I have a two-column data file like this
> 1.1    2.3
> 2.2    11.1
> 4.3    1.1
> ...
> Is it possible to substitue all '1.1' to some value else without using
> re.
>

Yes --

data = """1.1    2.3
2.2    11.1
4.3    1.1"""

newdata = data.replace("1.1","1.x")

but that's probably not what you want.

Emile 






More information about the Python-list mailing list