Я хочу сделать следующее с помощью str.format
:
x,y = 1234,5678
print str(x)[2:] + str(y)[:2]
Единственный способ, которым я смог это сделать:
print '{0}{1}'.format(str(x)[2:],str(y)[:2])
Теперь, этот пример и то, что у меня на самом деле - длинная и грязная строка, и поэтому я хочу разместить нарезку внутри {}
. Я изучил документы, но я не могу понять правильный синтаксис. Мой вопрос: возможно ли отрезать строки внутри поля замены?