numpy.char.splitlines()


此函数返回数组中的元素列表,在行边界处断开。

import numpy as np
print np.char.splitlines('hello\nhow are you?')
print np.char.splitlines('hello\rhow are you?')

其输出如下 -

['hello', 'how are you?']
['hello', 'how are you?']

'\ n','\ r','\ r \ n'可用作行边界。