title: python - convert dynamic string to variable
body: <p>I know there are quite a few threads about this matter, but I couldn't get it working so far. At the moment it prints the string and not the actual value (i.E. 12, 20,..)</p>
  <pre><code>import time
  
  global a1
  global v1
  a1 = 0.4
  v1 = 0.5
  
  global varZup
  global varZdown
  varZup=0.0065
  varZdown=0
  
  xx00=12
  yy00=12
  zz00=12
  rx00=12
  ry00=12
  rz00=12
  
  xx01=20
  yy01=20
  rx01=20
  ry01=20
  rz01=20
  
  xx02=312
  yy02=312
  rx02=312
  ry02=312
  rz02=312
  
  xx03=41
  yy03=41
  rx03=41
  ry03=41
  rz03=41
  
  global varCnt
  varCnt = 0
  
  global posCnt
  posCnt = 0
  
  while posCnt &lt; 40:
          sendx = &quot;xx&quot; + str(varCnt).zfill(2)
          sendy = &quot;yy&quot; + str(varCnt).zfill(2)
          sendrx = &quot;rx&quot; + str(varCnt).zfill(2)
          sendry = &quot;ry&quot; + str(varCnt).zfill(2)
          sendrz = &quot;rz&quot; + str(varCnt).zfill(2)
          #print(eval('sendx'))
          #exec(&quot;%s = %d&quot; % (sendx,int(sendx)))
          #print(&quot;movep(p[&quot; + exec(str(sendx)) + &quot;, &quot; + exec(str(sendy)) + &quot;, &quot; + &quot;{:.5f}&quot;.format(varZup) + &quot;, &quot; + exec(str(sendrx)) + &quot;, &quot; + exec(str(sendry)) + &quot;, &quot; + exec(str(sendrz)) + &quot;], a=&quot; + &quot;{:.5f}&quot;.format(a1) + &quot;, v=&quot; + &quot;{:.5f}&quot;.format(v1) + &quot;, r=0)&quot;)
          print(&quot;movep(p[&quot; + sendx + &quot;, &quot; + sendy + &quot;, &quot; + &quot;{:.5f}&quot;.format(varZup) + &quot;, &quot; + sendrx + &quot;, &quot; + sendry + &quot;, &quot; + sendrz + &quot;], a=&quot; + &quot;{:.5f}&quot;.format(a1) + &quot;, v=&quot; + &quot;{:.5f}&quot;.format(v1) + &quot;, r=0)&quot;)
          #s.send((&quot;movep(p[&quot; + &quot;{:.5f}&quot;.format(sendx) + &quot;, &quot; + &quot;{:.5f}&quot;.format(sendy) + &quot;, &quot; + &quot;{:.5f}&quot;.format(varzUp) + &quot;, &quot; + &quot;{:.5f}&quot;.format(sendrx) + &quot;, &quot; + &quot;{:.5f}&quot;.format(sendry) + &quot;, &quot; + &quot;{:.5f}&quot;.format(sendrz) + &quot;], a=&quot; + &quot;{:.5f}&quot;.format(a1) + &quot;, v=&quot; + &quot;{:.5f}&quot;.format(v1) + &quot;, r=0)&quot; + &quot;\n&quot;).encode(&quot;utf8&quot;))
          varCnt+=1
          time.sleep(1)
  </code></pre>
  <p>My tries with exec and eval failed so far (there ist nothing to execute), also it would be nice to get a one liner for the conversion and &quot;send&quot; command.</p>
  <p>I just wan't to &quot;fill in&quot; the variables into the string that gets sent to a robot later.</p>
  <p>EDIT:
  this works and gets better with every edit</p>
  <pre><code>my_list0 = [0.11946,-0.27553,-0.00058,3.14098,0.00296]
  my_list1 = [0.24737,-0.27553,2.20186,-2.23966,-0.00281]
  my_list2 = [0.31433,-0.27552,2.20190,-2.23959,-0.00277]
  my_list3 = [0.38954,-0.27554,2.20182,-2.23973,-0.00289]
  call_list = [my_list0, my_list1, my_list2, my_list3]
  
  while True:
     print(*call_list[varCnt][0:1], sep=&quot;, &quot;)
     print(*call_list[varCnt][3:4], sep=&quot;, &quot;)
     print(&quot;&quot;)
     varCnt+=1
     time.sleep(1)
  </code></pre>
  <p>EDIT2:
  now I need to compare some data using &quot;math&quot;, how to get floats in or out of these lists?</p>
  <p>TypeError: 'float' object is not iterable</p>
  <pre><code>        compareX = map(float, *call_list[varCnt][0:1])
          compareY = map(float, *call_list[varCnt][1:2])
          compare = math.isclose(compareX-xAct, compareY-yAct, abs_tol=0.0001)
  </code></pre>