(c_value)
| 512 | else: |
| 513 | # Calculate column widths |
| 514 | def get_width(c_value): |
| 515 | l = 0 |
| 516 | if c_value: |
| 517 | if isinstance(c_value, str): |
| 518 | l = len(c_value) |
| 519 | elif isinstance(c_value, list): |
| 520 | l = max((len(str(x)) for x in c_value if x), default=0) |
| 521 | else: |
| 522 | l = len(str(c_value)) |
| 523 | if l > 50: |
| 524 | l = 50 |
| 525 | return l |
| 526 | |
| 527 | if headers: |
| 528 | widths = [max(len(x), 10) if x else 0 for x in headers] |