python align text

#rjust () ljust ()
from spam = 'Hello'
Print (spam.rjust (20, '*')) with a length of 20 right justified # '*' filled with
print (spam.ljust (10, '. ')) # Left aligned with the length 10 '' filled with
print (spam.center (15, '= ')) # 15 with play to its length '=' filled

Guess you like

Origin www.cnblogs.com/shunguo/p/11441636.html