少年阿賓

          那些青春的歲月

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            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 閱讀(499) 評論(0)  編輯  收藏 所屬分類: python

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 弥勒县| 调兵山市| 合水县| 乐山市| 唐河县| 虞城县| 通州区| 林周县| 阿拉善右旗| 金溪县| 察哈| 泗洪县| 岱山县| 余江县| 新野县| 昭平县| 吴桥县| 香港| 台北县| 博野县| 丽水市| 灵寿县| 嘉黎县| 随州市| 瑞金市| 武邑县| 商洛市| 江陵县| 漳州市| 繁峙县| 北海市| 溧水县| 台南县| 汝阳县| 泰州市| 平武县| 巨鹿县| 东山县| 翁源县| 乌兰县| 湟中县|