title: python iterate over sql query for select statement
body: <p>How do i execute select statement for all the 4 id's that is 10, 20, 34 and 1 and would expect the result to be in a list</p>
  
  <pre><code>import pymysql
  import json
  
  conn = pymysql.connect(host='localhost', port=3306, user='root', passwd='', 
  db='mydb', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor)
  
  cursor = conn.cursor()
  
  select_query = "select * from users where id = "
  ids = ["10", "20", "34", "1"]
  for x in ids:
      var = select_query + x
      # print(var)
      print(list(cursor.execute(var)))
  </code></pre>