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

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -