This function returns a list of elements in the array, breaking at line boundaries.Live Demo
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.