I try:
def test(w,sli): s = \"\'{0}\'{1}\".format(w,sli) exec(s) return s print test(\"TEST12344\",\"[:2]\")
its return \'TEST