[Tutor] Messy - Very Messy string manipulation.

Peter Otten __peter__ at web.de
Wed Oct 28 13:35:20 EDT 2015


Alan Gauld wrote:

> On 28/10/15 16:37, Peter Otten wrote:
> 
>>>>> 'The cow moos louder than the frog'.translate(str.maketrans("", "",
>> "aeiouAEIOU"))
>> 'Th cw ms ldr thn th frg'
> 
> Even easier, forget the maketrans stuff and just use
> 
> 'The cow moos louder than the frog'.translate(None,'aeiouAEIOU')

This only works for byte strings, not unicode.



More information about the Tutor mailing list