alinhe um python de texto
def alignto(x: int = ..., direction: str = ..., message: str = ...):
if direction == 'left':
return f"{message:<{x}}"
elif direction == 'right':
return f"{message:^{x}}"
elif direction == 'center':
return f"{message:>{x}}"
else:
raise ValueError('direction must be left, right, or center')
# Try it with print(alignto(15, 'left', 'hi'), alignto(15, 'right', 'hi'), alignto(15, 'center', 'hi'))
Blyxyas