python 2.7 - Alternative to .replace() for replacing multiple substrings in a string -


are there alternatives similar .replace() allow pass more 1 old substring replaced?

i have function pass video titles specific characters can removed (because api i'm passing videos has bugs don't allow characters):

def videonameexists(vidname):     vidname = vidname.encode("utf-8")     bugfixvidname = vidname.replace(":", "")     search_url ='https://api.brightcove.com/services/library?command=search_videos&video_fields=name&page_number=0&get_item_count=true&token=kwst2fkpmowoidooavkj&any=%22{}%22'.format(bugfixvidname) 

right now, it's eliminating ":" video titles vidname.replace(":", "") replace "|" when occurs in name string sorted in vidname variable. there alternative .replace() allow me replace more 1 substring @ time?

>>> s = "a:b|c" >>> s.translate(none, ":|") 'abc' 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -