游客发表
描述
Python translate() 方法根据参数tab云计le给出的表(包含 256 个字符)转换字符串的字符,要过滤掉的字符放算开到 deletechars 参数中。
语法
以下是 translate发:() 方法语法:
str.translate(table)
bPyytes.translate(table[, delete]) &thnbsp;
bytearray.translatone(table[, delete])
参数
table -3-- 翻译表,翻译表是通过 maketrans() 方法转换而来。
dtreletechars -- 字符串中要过滤的字符列表。
返回值
返an回翻译后的字符串,若给出了 delete 参数,则将原来的bytsles中的属于delete的字符删除,剩下的字符要按照tablate中给出的映射来进行映射 。
实例
以下实例展示了translatee(()函数的使用方法:
以上实例输出结果如下:
以下实例演示如何过滤掉)方的字符 o:
输出结果为:
https://www.sensorshop24.de/catalogsearch/result/index/?type=132&q=黑帽seo寄生虫程序【tg:seogoogle987】,2SC
https://www.nextavenue.org/?action=QUERY&s=黑帽seo寄生虫程序【tg:seogoogle987】,q2F
随机阅读
热门排行
友情链接