Skynet

          ---------- ---------- 我的新 blog : liukaiyi.cublog.cn ---------- ----------

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            112 Posts :: 1 Stories :: 49 Comments :: 0 Trackbacks
          參考:
          顯示   【sheet數】【sheet Name】【(第一行,第一列)】  
          print sheets[0][1][(0,0)]


          from pyExcelerator import *
          sheets = parse_xls('src/天娛版權明確的歌曲清單.xls')
          sdata=sheets[0][1]

          #按行數 迭代
          for tnum in range(max([tmp[0] for tmp in sdata])):
           print sdata[(tnum,0)],'-',sdata[(tnum,1)]

           





          from pyExcelerator import *
          import os
          sheets 
          = parse_xls('xls/版權確認清單表20090601.3.xls')
          cpcc
          = parse_xls('xls/CP對應表.xls')

          g2u
          =lambda str : str.decode('gbk')
          bmug
          =lambda str : unicode(str).encode("gbk")
          def cfsize(cha):
              
          if len(cha)==1
                  
          return ord(cha)-ord('A'
              
          else : 
                  fsize
          =0
                  fnum
          =cfsize('Z')+1
                  cc
          =list(cha)
                  
          for tnum in range(len(cc)):
                      fsize
          +=fnum*tnum+cfsize(cc[tnum])
                  
          return fsize



          cpccmap
          ={}
          tsdata
          =cpcc[0][1]
          for tnum in range(max([tmp[0] for tmp in tsdata]))[:]:
              cpname
          =tsdata[(tnum,cfsize('A'))]
              cpid
          =("%s" % (tsdata[(tnum,cfsize('B'))])).split(".")[0]
              cpccmap[cpname]
          =cpid


          def insertData(cpid,cpname, music,actor,copyrightname,ytime,txls,rows):
              
          #print music,actor,cpname,ytime,txls,rows
              txls.write(rows,cfsize('A'),music)
              txls.write(rows,cfsize(
          'B'),actor)
              txls.write(rows,cfsize(
          'C'),cpname)
              txls.write(rows,cfsize(
          'D'),u'中國大陸')
              txls.write(rows,cfsize(
          'E'),u'')
              txls.write(rows,cfsize(
          'F'),u'')
              txls.write(rows,cfsize(
          'G'),u'')
              txls.write(rows,cfsize(
          'H'),u'')
              txls.write(rows,cfsize(
          'I'),ytime.split(' ')[0])
              txls.write(rows,cfsize(
          'J'),u'')
              txls.write(rows,cfsize(
          'K'),'0')
              txls.write(rows,cfsize(
          'L'),u'許可')
              txls.write(rows,cfsize(
          'M'),'200')
              txls.write(rows,cfsize(
          'N'),u'許可')
              txls.write(rows,cfsize(
          'O'),'0')
              txls.write(rows,cfsize(
          'P'),u'許可')
              txls.write(rows,cfsize(
          'Q'),'0')
              txls.write(rows,cfsize(
          'U'),copyrightname)
              
              txls.write(rows,cfsize(
          'V'),'100%')
              txls.write(rows,cfsize(
          'W'),cpname)
              txls.write(rows,cfsize(
          'X'),'100%')


          cpmap
          ={}
          for tsdata in sheets :
              
          try:
                  sdata
          =tsdata[1]
                  
          #按行數 迭代 
                  for tnum in range(max([tmp[0] for tmp in sdata]))[1:]:
                      cpid
          =sdata[(tnum,cfsize('C'))]
                      cpname
          =sdata[(tnum,cfsize('D'))] #.upper()
                      music=sdata[(tnum,cfsize('E'))]
                      actor
          =sdata[(tnum,cfsize('F'))]
                      copyrightname
          =sdata[(tnum,cfsize('H'))]
                      ytime
          =sdata[(tnum,cfsize('K'))]
                      
          if not cpmap.has_key(cpname) :
                          tmpf
          =bmug("cp -r 0000_20090602/ data3/"+cpid+"_20090602/ " )
                          os.system(tmpf)
                          txls
          =Workbook()
                          tsheet
          =txls.add_sheet(u'版權列表')
                          cpmap[cpname]
          =[txls,1,'data3/'+cpid+u'_20090602/產品信息/'+cpid+'_20090602_01_copyright.xls',tsheet]
                          titles
          ='歌曲名稱    演唱者    提供者    授權區域    電子化版權信息(有/無)    需要DRM處理(是/否)    支持二次開發(是/否)    相關版權合同記錄(有/無)    授權期限    全曲授權    全曲價格    彩鈴授權    彩鈴價格    IVR授權    IVR價格    振鈴授權    振鈴價格    ISRC    UPC    ICPN    詞曲著作權權利人一    詞曲比例一    錄音權權利人一    錄音比例一    詞曲著作權權利人二    詞曲比例二    錄音權權利人二    錄音比例二    詞曲著作權權利人三    詞曲比例三    錄音權權利人三    錄音比例三    其它'.split('\t')
                          
          for ttnum in range(len(titles)):
                              tsheet.write(0,ttnum,g2u(titles[ttnum]))
                          insertData(cpid,cpname, music,actor,copyrightname,ytime,tsheet,
          1)
                      
          else :
                          tsheet
          =cpmap[cpname][3]
                          cpmap[cpname][
          1]=cpmap[cpname][1]+1
                          insertData(cpid,cpname, music,actor,copyrightname,ytime,tsheet,cpmap[cpname][
          1])
              
          except :
                  
          print "[error]: ", music,actor,cpname,ytime,txls
                  
          pass


          for tkey in cpmap.keys() :
              ct
          =cpmap[tkey]
              
          print ct[2]
              ct[0].save(ct[
          2])





           



          整理 www.aygfsteel.com/Good-Game
          posted on 2009-05-29 22:23 劉凱毅 閱讀(559) 評論(0)  編輯  收藏 所屬分類: python
          主站蜘蛛池模板: 琼结县| 岗巴县| 乐安县| 大余县| 玉门市| 石林| 商洛市| 平安县| 天门市| 萍乡市| 哈密市| 新丰县| 明水县| 云阳县| 龙口市| 新河县| 潮安县| 二连浩特市| 应用必备| 安乡县| 天柱县| 离岛区| 新巴尔虎右旗| 九龙城区| 包头市| 荣成市| 巩义市| 东兴市| 北流市| 中山市| 渑池县| 无棣县| 大洼县| 迁西县| 静乐县| 鄯善县| 嘉善县| 海原县| 原阳县| 和静县| 修水县|