少年阿賓

          那些青春的歲月

            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 閱讀(507) 評論(0)  編輯  收藏 所屬分類: python

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


          網站導航:
           
          主站蜘蛛池模板: 香格里拉县| 松江区| 历史| 集安市| 孟连| 黄平县| 武平县| 镇远县| 鹿泉市| 云安县| 赞皇县| 株洲县| 八宿县| 苏尼特右旗| 会同县| 略阳县| 宜昌市| 聂拉木县| 庆元县| 屏南县| 奉新县| 禹州市| 眉山市| 奉节县| 中方县| 凤凰县| 开封县| 桂东县| 桐乡市| 乡宁县| 康马县| 田东县| 崇义县| 额尔古纳市| 深泽县| 岳阳市| 平遥县| 威海市| 徐水县| 广昌县| 拉萨市|