Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using uneven #3

Open
cristobalvch opened this issue Mar 7, 2022 · 1 comment
Open

Error using uneven #3

cristobalvch opened this issue Mar 7, 2022 · 1 comment

Comments

@cristobalvch
Copy link

When i try to specify the parameter uneven, it shows this error

line 125, in create_table
col_width = get_col_widths()
line 86, in get_col_widths
for col in range(len(table_data[0])): # for every row
KeyError: 0

@ohbhatt
Copy link

ohbhatt commented Mar 12, 2024

Replace the elif statement by

elif col_width == 'uneven':
    col_widths = []
    
    for col in table_data:
        longest = self.get_string_width(col)
        for element in table_data[col]:
            if longest < self.get_string_width(element):
                longest = self.get_string_width(element)
        col_widths.append(longest + 4)
    col_width = col_widths

Hope it helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants