>>> print 'there are {0:10} students and {1:10} teachers'.format(scnt, tcnt) there are 100 students and 20 teachers
Каким был бы код, чтобы вывод стал:
there are 100 students and 20 teachers
Спасибо.
print 'there are {0:<10} students and {1:<10} teachers'.format(scnt, tcnt)
В то время как старый оператор % использует - для выравнивания, новый метод format использует < и >
%
-
format
<
>