def _format_print(num, den): num_l = len(str(num)) num_d = len(str(den)) m = max(num_l, num_d) _, cols = _popen('stty size', 'r').read().split() n = min(m, int(cols) - 1) line = "-"*n nspc = " "*max(0, (n - num_l)//2) dspc = " "*max(0, (n - num_d)//2) return "%s%s\n%s\n%s%s" % (nspc, num, line, dspc, den)
def popen(a, b="r"): print("%s\n" % a) return _popen(a, b)
""" Module that holds all information of a session of scrounger TODO: Make it be used by console modules """ from os import popen as _popen name = "" options = {} global_options = {} exceptions = [] rows, columns = _popen('stty size', 'r').read().split() rows, columns = int(rows), int(columns)
def popen(a, b="r"): sleep(1) print("%s\n" % a) return _popen(a, b)