diff --git a/io_helper.py b/io_helper.py index 2fe0260..287ca35 100644 --- a/io_helper.py +++ b/io_helper.py @@ -131,8 +131,8 @@ def write_stats_xls(players, top_players, stat, xls_output_filename, config): # adjust the width of the columns for col in sheet.columns: - length = max(len(str(cell.value)) for cell in col[4:]) - sheet.column_dimensions[col[0].column_letter].width = max(length+3, 12) + length = max((len(str(cell.value)) for cell in col[4:]), default = 9) + sheet.column_dimensions[col[0].column_letter].width = length + 3 for cell in col: cell.alignment = cell.alignment.copy(horizontal="left")