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:

replace('/', '_').replace('?', '_').replace('.', '_')

if I put these strings in a list

remove = ['/', '.', '?']

I get this error:

AttributeError: 'list' object has no attribute 'replace'

Thanks

Norman

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to