numpy.char.split#

char.split(a, sep=None, maxsplit=None)[源代码]#

对于 a 中的每个元素,返回一个使用 sep 作为分隔符的字符串中的单词列表.

逐元素调用 str.split.

参数:
a : 类似数组的对象,具有 StringDTypebytes_str_ 数据类型类数组对象
sepstr 或 unicode,可选

如果 sep 未指定或为 None,任何空白字符串都是分隔符.

maxsplitint, 可选

如果给出了 maxsplit ,最多进行 maxsplit 次分割.

返回:
outndarray

列表对象数组

参见

str.split, rsplit

示例

>>> import numpy as np
>>> x = np.array("Numpy is nice!")
>>> np.strings.split(x, " ")  
array(list(['Numpy', 'is', 'nice!']), dtype=object)  
>>> np.strings.split(x, " ", 1)  
array(list(['Numpy', 'is nice!']), dtype=object)