求助:用python写一段与mysql语句相关的简单程序。cur.execute中用迭代的问题。
楼主想求大侠用python中将下面mysql语句自动输出。
cur.execute( "select contents from table_materialshighschool where id=1 into outfile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/m1.txt';")
cur.execute( "select contents from table_materialshighschool where id=2 into outfile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/m2.txt';")
cur.execute( "select contents from table_materialshighschool where id=3 into outfile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/m3.txt';")
cur.execute( "select contents from table_materialshighschool where id=4 into outfile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/m4.txt';")
cur.execute( "select contents from table_materialshighschool where id=5 into outfile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/m5.txt';")
cur.execute( "select contents from table_materialshighschool where id=6 into outfile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/m6.txt';")
cur.execute( "select contents from table_materialshighschool where id=7 into outfile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/m7.txt';")
cur.execute( "select contents from table_materialshighschool where id=8 into outfile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/m8.txt';")
cur.execute( "select contents from table_materialshighschool where id=9 into outfile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/m9.txt';")
cur.execute( "select contents from table_materialshighschool where id=10 into outfile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/m10.txt';")
--------------------------------------------------------------------------------------------------------------------------
cur.execute( "select contents from table_materialshighschool where id=n into outfile 'C:/ProgramData/MySQL/MySQL Server 5.7/Uploads/mn.txt';")