Onionr/src/utils/boxprint.py

8 lines
284 B
Python
Raw Normal View History

2020-02-08 10:24:19 +00:00
def bordered(text):
lines = text.splitlines()
width = max(len(s) for s in lines)
res = ['' + '' * width + '']
for s in lines:
res.append('' + (s + ' ' * width)[:width] + '')
res.append('' + '' * width + '')
return '\n'.join(res)