numpy.char.splitlines()


Advertisements

This function returns a list of elements in the array, breaking at line boundaries.

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

Its output is as follows −

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

'\n', '\r', '\r\n' can be used as line boundaries.

numpy_string_functions.htm
Advertisements