PyWombat

Justificar texto

Nuevo tip

Es posible justificar el texto de los strings utilizando los métodos: ljust, rjust o center. 🐍

  • ljust -> Justifica a la izquierda.
  • rjust -> Justifica a la derecha.
  • center -> Centra.
>>> message = 'Hola mundo!'

>>> message.ljust(20)
'Hola mundo!         '

>>> message.rjust(20)
'         Hola mundo!'

>>> message.center(20)
'    Hola mundo!     '