Reputation: 4773
>>> 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.
Upvotes: 11
Views: 12915
Reputation: 192921
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 >
Upvotes: 23