How to set the number of spaces occupied by tabs in print ('\ tPython') in the python interpreter?

I opened the python interpreter using python3 under Ubuntu18.04. The default tab is equal to 8 spaces. Can the number of spaces occupied by this tab be set?

>>> print("\tPython")
        Python
Nov.02,2021

  @ wt1187982580  provides a solution by using python's built-in string method expandtabs to convert tabs in strings to spaces. 

in fact, when you output tabs to the terminal, the terminal uses its configured number of placeholders to output spaces. So, you can use tabs-4 to set the placeholder of your current terminal tab to 4. In this way, all tab output at the terminal uses four spaces

Menu