Godtone
Joined 17 December 2020
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]' | ||
# use str.ljust(width,space) and str.rjust(width,space) for left- and right-padding | |||
# and use str.center(width,space) if you dont want to centre around a specific character (e.g '/') | |||
def pad(what,width,centre='/',space=' '): | def pad(what,width,centre='/',space=' '): | ||
if len(what) >= width: | if len(what) >= width: | ||