如何用表中的替换值替换字符串中的单词?例如:
domain = "If i want to listen najtkor, i would like to play raszyn song named voyager"
ExceptionTable = {
'najtkor': 'nightcore',
'raszyn': 'russian',
'voyager': 'voyage',
}
if domain in ExceptionTable:
domain = ExceptionTable[domain]
结果应该是:
domain = "If i want to listen nightcore, i would like to play russian song named voyage"