[Tutor] Conflicted

Eve Kotyk e.kotyk@shaw.ca
Sat, 06 Apr 2002 20:12:22 +0000


--=.)M/uXGul8f..Ci
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit


> > I am however not quite clear as to why the whole line is being
> > replace rather than just the string requested.    > 
> 
> >>> s = 'My name is mud'
> >>> s.replace('mud', 'Sean')
> 'My name is Sean'
> >>> s
> 'My name is mud'

Ok, perhaps I'm being a little dim but if I do

s = 'Spam is not ham'
s.replace('Spam', '')
and write it to a new file, should I not get 'is not ham'?

Instead I am getting an empty file or in the case of multiple lines in
the file, the whole of the line 'Spam is not ham' is gone but 'I'm fond
of ham' remains. 

E
- 

ekotyk

http://members.shaw.ca/e.kotyk/virtualstudio.htm

--=.)M/uXGul8f..Ci
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8r1apyxm8dPG0oMIRAorvAJ9G53Vd3sS1v0ctC0NcpXBTZlOCDwCglozV
LUnOvVVqEikt+REURaFVbmM=
=Qndy
-----END PGP SIGNATURE-----

--=.)M/uXGul8f..Ci--