📜  Numpy字符串操作 |分割线()函数

📅  最后修改于: 2022-05-13 01:56:56.284000             🧑  作者: Mango

Numpy字符串操作 |分割线()函数

在这个numpy.core.defchararray.splitlines()函数中,arr 中的每个元素都返回元素中的行列表,在行边界处中断。

代码#1:

Python3
# Python program explaining 
# numpy.char.splitlines() function 
  
# importing numpy as geek  
import numpy as geek 
  
gfg = geek.char.splitlines('GeeksforGeeks \n A computer science portal \n for geeks')
    
print (gfg)


Python3
# Python program explaining 
# numpy.char.splitlines() function 
  
# importing numpy as geek  
import numpy as geek 
  
gfg = geek.char.splitlines('This is \r a Python-Numpy \r article \r for geeks')
    
print (gfg)


输出 :

代码#2:

Python3

# Python program explaining 
# numpy.char.splitlines() function 
  
# importing numpy as geek  
import numpy as geek 
  
gfg = geek.char.splitlines('This is \r a Python-Numpy \r article \r for geeks')
    
print (gfg)

输出 :