sql = (
    """SELECT avg(downloadtime) FROM tb_npp where date(date) = %s 
         and substring(host,6,3) in ({c})"""
    .format(c=', '.join(['%s'] * len(dc))))
args = ['2013-07-01'] + dc
mysql-connector python 'IN' operator stored as list