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’]