HomeLanguagesPython | Numpy expandtabs() method

Python | Numpy expandtabs() method

With the help of numpy.char.expandtabs() method, we can expand the tab using numpy method in the single statement.

Syntax : numpy.char.expandtabs()

Return : Return the string array having expanded tabs.

Example #1 :

In this example we can see that by using numpy.char.expandtabs() method, we are able to get the expanded tabs by using numpy.




# import numpy
import numpy as np
  
# using numpy.char.expandtabs() method
gfg = np.char.expandtabs(['Geeks\tFor\tGeeks'], 10)
  
print(gfg)


Output :

[‘Geeks For Geeks’]

Example #2 :




# import numpy
import numpy as np
  
# using numpy.char.expandtabs() method
gfg = np.char.expandtabs(['G\tF\tG', 'Jitender\tKumar'], 20)
  
print(gfg)


Output :

[‘G F G’ ‘Jitender Kumar’]

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32688 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7057 POSTS0 COMMENTS
Nicole Veronica
12198 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12293 POSTS0 COMMENTS
Shaida Kate Naidoo
7182 POSTS0 COMMENTS
Ted Musemwa
7447 POSTS0 COMMENTS
Thapelo Manthata
7160 POSTS0 COMMENTS
Umr Jansen
7150 POSTS0 COMMENTS