import numpy as np print(np.char.add(["hello"],["baby"]))#['hellobaby'] print(np.char.add(["hello","A"],["baby","B"]))#['hellobaby' 'AB'] print(np.char.multiply("nimei",3))#多个字符串叠加成一个字符串 print(np.char.center("*",20,fillchar="_"))#字符串填充 print(np.char.capitalize("nimei"))#返回字符串开头大写 print(np.char.title("nimeititle,hao are you"))#每个字母开头大写 print(np.char.lower("ABC")) print(np.char.upper("abc")) print(np.char.splitlines("hellp 123213"))#按行切割 print(np.char.split("hellp 123213",sep=" "))#按sep切割 print(np.char.strip(" A A A "))#取出首尾空格 print(np.char.str_len("ABCD E"))#求长度 print(np.char.join(":","ABC"))#每个字母拼接: print(np.char.join(":",["ABC","EFG"]))#每个字符串每个字母拼接: print(np.char.join([":","@"],["ABC,EFG"]))#对应拼接 print(np.char.replace("hello A","A","B"))#A替换成B print(np.char.encode("富强","utf-8"))#编码 print(np.char.decode(b'xe5xafx8cxe5xbcxba',"utf-8"))#解码