[Tutor] creating the equivalent of string.strip()

Ricardo Aráoz ricaraoz at gmail.com
Thu Oct 4 01:48:02 CEST 2007


Alan Gauld wrote:
> "Ricardo Aráoz" <ricaraoz at gmail.com> wrote
> 
>>> It still won't work. Strings are immutable, you can't use del
>>> to delete a character. Try it.
>> It comes straight from Idle (still warm ;-) ).
>> Notice s = list(s)
> 
> Shame and embarrassment! I read that code through both times and
> never noticed the list conversion either time! I did wonder about the
> join() but just dismissed it as irrelevant.
> 
> Grovelling apologies.
> 

Don't worry, you can imagine MY 'shame and embarrasment' at being
pointed that the while's should go separate as opposed to one within the
other.  87(




More information about the Tutor mailing list