Python 标准库 —— string

1. maketrans()/translate()

  • maketrans(frm, to) -> string, 建立从字符串 frm 到 to 的映射表(字符串的形式);
  • translate(s,table [,deletions]) -> string,根据 maketrans(frm, to) 得到的 table,将新的字符串 s 进行映射;
原文地址:https://www.cnblogs.com/mtcnn/p/9423093.html