>>> print 'there are {0:10} students and {1:10} teachers'.format(scnt, tcnt)
there are 100 students and 20 teachers
What would be the code so that the output became:
there are 100 students and 20 teachers
Thanks.
print 'there are {0:<10} students and {1:<10} teachers'.format(scnt, tcnt)
While the old %
operator uses -
for alignment, the new format
method uses <
and >
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With