少年阿賓

          那些青春的歲月

            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

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


          網站導航:
           
          主站蜘蛛池模板: 建平县| 遵义市| 吉木萨尔县| 兴国县| 马山县| 七台河市| 堆龙德庆县| 苍梧县| 双柏县| 屯门区| 延吉市| 庆云县| 环江| 施秉县| 黔江区| 金川县| 龙口市| 武义县| 家居| 定结县| 淮北市| 化德县| 永德县| 垫江县| 遵化市| 郸城县| 泰来县| 凭祥市| 江源县| 蓝山县| 丹凤县| 将乐县| 祁连县| 当涂县| 惠来县| 棋牌| 海丰县| 九龙县| 华蓥市| 嵩明县| 农安县|