NumPy char splitlines

NumPy char splitlines

In this chapter, we will discuss about NumPy char splitlines. 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.

Next Topic – Click Here

This Post Has 2 Comments

Leave a Reply