Skip to content

Instantly share code, notes, and snippets.

@Nachtalb
Nachtalb / col_print.py
Last active February 9, 2018 14:48 — forked from critiqjo/col_print.py
Python: Multi-column printing of a list of strings
def col_print(lines, term_width=None, indent=0, pad=2):
"""Print list of strings in multiple columns
Original: https://gist.github.com/critiqjo/2ca84db26daaeb1715e1
Adjusted: https://gist.github.com/Nachtalb/8a85c0793b4bea0a102b7414be5888d4
"""
if not term_width:
size = shutil.get_terminal_size((80, 20))
term_width = size.columns