How can I specify the amount of spaces between columns by using tabulate module in python
12:44 23 Apr 2022

Id like to know if there is some argument I can pass to tabulate module and specify the quantity of empty spaces between columns.

I can see there are 2 spaces by default but I didnt find how do manipulate that. This is script example.

from tabulate import tabulate

data = [
  ["Name","LastName", "Age"],
  ["Juan","Lopez", "22"],
  ["Luisa","Perez", "24"],
  ["Ana","Sanchez", "23"]
]

print (tabulate(data, stralign="right", tablefmt="plain"))

Output:

 Name  LastName  Age
 Juan     Lopez   22
Luisa     Perez   24
  Ana   Sanchez   23

The complete task is about extract data from a plan text and organize it. One way I did to solve the problem was adding empty columns between each data column but maybe is not the most eficcient way.

python tabulate