I want to achieve the following with
x,y = 1234,5678
print str(x)[2:] + str(y)[:2]
No, you cannot apply slicing to strings inside a the replacement field.
You'll need to refer to the Format Specification Mini-Language; it defines what is possible. This mini language defines how you format the referenced value (the part after the
: in the replacement field syntax).