numpy.char.split#
- char.split(a, sep=None, maxsplit=None)[源代码]#
对于 a 中的每个元素,返回字符串中的单词列表,使用 sep 作为分隔符字符串.
逐元素调用
str.split.- 参数:
- a : 类数组,具有
StringDType,bytes_或str_dtype类数组,具有 - sepstr 或 unicode,可选
如果未指定 sep 或为 None,则任何空白字符串都是分隔符.
- maxsplit整数,可选
如果指定了 maxsplit ,则最多完成 maxsplit 次分割.
- a : 类数组,具有
- 返回:
- outndarray
列表对象数组
示例
>>> 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)