python translate maketrans 字符串替换

string1='abcd-1234'
print(string1.translate(string1.maketrans('abc','ABC')))

a='aeiou'
b='12345'
string2='aasdfwe'
print(string2.maketrans(a,b))
print(string2.translate(string2.maketrans(a,b)))

 

posted @   OnePiece!  阅读(302)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示