NumPy - numpy.char.replace() 函数
-
简述
此函数返回输入字符串的新副本,其中所有出现的字符序列都被另一个给定序列替换。import numpy as np print np.char.replace ('He is a good boy', 'is', 'was')
它的输出如下 -He was a good boy
import numpy as np
print np.char.replace ('He is a good boy', 'is', 'was')
He was a good boy