show. Align content line, after line number in read_lines()

This commit is contained in:
Cyrille L 2023-03-28 14:45:47 +02:00
parent b6799ab360
commit 101a1e09e7
1 changed files with 3 additions and 2 deletions

View File

@ -145,12 +145,13 @@ def read_lines(f):
if not tyto.exists(f): logs.out("1", f, True)
datas = open(f).read()
# Align content line, after line number
ln_datas = len(datas.splitlines()) + 1
sp_max = len(str(ln_datas))
spaces = '%s'%(sp_max * " ")
for ln, line in enumerate(datas.rsplit('\n'), 1):
sp = sp_max - len(str(ln))
print('%s %s%s'%(ln, int(sp) * " ", line))
dom.valid()