少年阿賓

          那些青春的歲月

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks
          import MySQLdb
          import csv
          try:
              conn=MySQLdb.connect(host='localhost',user='root',passwd='',db='abin',port=3306)
              cursor=conn.cursor()
              result = cursor.execute('select * from tabin')
              info=cursor.fetchmany(result)
              writer = csv.writer(file('your.csv','wb'))
              writer.writerow(['id','name','time'])
              for line in info:
                  writer.writerow(line)
          except MySQLdb.Error,e:
              print 'MySQLError is : ',e.args[0]
          posted on 2015-01-28 16:16 abin 閱讀(505) 評論(0)  編輯  收藏 所屬分類: python

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 申扎县| 洪湖市| 安岳县| 富蕴县| 琼中| 河源市| 肇州县| 郁南县| 扶余县| 清丰县| 湟中县| 新闻| 肃宁县| 普定县| 乌海市| 福州市| 安阳市| 小金县| 兰考县| 淳安县| 杨浦区| 五常市| 专栏| 秦皇岛市| 柯坪县| 湘西| 沐川县| 富阳市| 清水县| 左贡县| 临澧县| 北票市| 晋宁县| 阜新市| 武川县| 大冶市| 西安市| 乌拉特中旗| 大同市| 根河市| 阳泉市|