Godtone (talk | contribs)
Godtone (talk | contribs)
m My Python 3 code: this functionality is mostly provided in Python 3 already
Line 632: Line 632:
return str(n)+'/'+str(d)
return str(n)+'/'+str(d)
return '[not interval]'
return '[not interval]'
def left_pad(what,width,space=' '):
# use str.ljust(width,space) and str.rjust(width,space) for left- and right-padding
return (width-len(what))*space + what
# and use str.center(width,space) if you dont want to centre around a specific character (e.g '/')
def right_pad(what,width,space=' '):
return what + (width-len(what))*space
def pad(what,width,centre='/',space=' '):
def pad(what,width,centre='/',space=' '):
if len(what) >= width:
if len(what) >= width: