title: How to return value from exec in function?
body: <p>I try:</p>
  
  <pre><code>def test(w,sli):
      s = "'{0}'{1}".format(w,sli)
      exec(s)
      return s
  
  print test("TEST12344","[:2]")
  </code></pre>
  
  <p>its return 'TEST12344'[:2]</p>
  
  <p>How to return value from exec in function</p>