Re: [Tutor] how to use replace() from a list

2007-06-17 Thread Kent Johnson
Norman Khine wrote: > > Hi I have this class: > > def title_to_name(title): > title = title.encode('ascii', 'replace') > name = title.lower().replace('/', '_').replace('?', > '_').replace('.', '') > return '_'.join(name.split()) > > Is there a way to have just one replace and so that

Re: [Tutor] how to use replace() from a list

2007-06-16 Thread Alan Gauld
"Norman Khine" <[EMAIL PROTECTED]> wrote >name = title.lower().replace('/', '_').replace('?', > '_').replace('.', '') >return '_'.join(name.split()) > > Is there a way to have just one replace and so that: Check out the string.maketrans() function and the translate method. Basically y