Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def mystrlen(s):
- return max(len(line) for line in str(s).split('\n'))
- def autodetectWidth(data):
- widths = [0]*len(data[0])
- for line in data:
- for i in range(len(line)):
- widths[i] = max(widths[i], mystrlen(line[i]))
- return widths
- # use: myTable.set_cols_width(autodetectWidth(list_of_rows))
- # requires an additional iteration over the data, so won't work with generators etc, use list()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement