Title / Description
Code <pre><code class="python"> #envio de datos a MySQL import MySQLdb db=MySQLdb.connect(host="localhost",user="pepe",passwd="nopw",db="asdfasdf") cursor = db.cursor() ID_C1=('3168','3369','3333','1289','1234','1942','1988','1568','1737','1922') ID_C2=('0146','0260') ID_C3=('1677','1860','1883','1975','1976','1992','1997','3280','3377','3387','3390','3409','3970','0331','0332','0333','0334','0335','0336','0337','0338','0339','0340','0341','0342','0343','0344','0345','0346','0347','0348','0349','0350','0351','0352','0353','0354','0355','0356','0357','0358','0576','0577','0578','0579','0580','0581','0582','0583','0584','0585','0586','0587','0588','0589') for b in ID_C1: cursor.execute("insert into rad (I,DIV,BRI,BAT,COM) values (%s, 'JED', 'CEM','ESC','UFC')" %b) for b in ID_C2: cursor.execute("insert into rad (I,DIV,BRI,BAT,COM) values (%s, 'JED', 'CEM','ESC','USA')" %b) for b in ID_C3: cursor.execute("insert into radios (I,DIV,BRI,BAT,COM) values (%s, 'DIV05', 'BR13','BACON1','?')" %b) db.commit() cursor.execute("select * from radios") resultado=cursor.fetchall() print resultado </code></pre>
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code