Python | Numpy expandtabs () method



With the numpy.char.expandtabs() method we can expand the tab using the numpy method in one statement.

Syntax: numpy.char.expandtabs()

Return: Return the string array having expanded tabs.

Example # 1:

In this example, we see that with numpy.char.expandtabs () we can get extended tabs with numpy.

# NumPy import

import numpy as np

 
# using the numpy.char.expandtabs () method

gfg = np.char.expandtabs ([ `Geeks For G eeks` ], 10 )

 

print (gfg)

Output:

[`Geeks For Geeks`]

Example # 2:

# NumPy import

import numpy as np

 
# using the numpy.char.expandtabs () method

gfg = np.char.expandtabs ([ ` GFG` , `Jitender Kumar` ], 20 )

 

print (gfg)

Output:

[`GF G` `Jitender Kumar`]