This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def max_col_widths(table): | |
""" | |
Return a list with the widest column length in | |
each column from the table. | |
""" | |
result = [] | |
for column in zip(*table): | |
max_ = 0 | |
for elem_in_column in column: | |
max_ = max(len(str(elem_in_column)), max_) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# will prepend or define XPATH with the value unless it already exists | |
# any empty arguments will not be added | |
robust_prepend() | |
{ | |
case ":${XPATH-}:" in | |
*:"${1-}":*) ;; | |
*) XPATH="${1-}${XPATH:+${1:+:}$XPATH}" | |
esac | |
} |
NewerOlder