Skynet

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

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            112 Posts :: 1 Stories :: 49 Comments :: 0 Trackbacks


          代碼上
          # -*- coding: gbk -*-
          #
              對應參考excel(obj)
          #
                  提供訪問excel 參考 sql 訪問接口
          #
          excelAction.py   "G:\Documents and Settings\ch\桌面\非四大總計.xls" "A,C,B" "|"
          from pyExcelerator import *
          import sys

          txls 
          = parse_xls(sys.argv[1])
          findcols
          =sys.argv[2].split(',')
          tsplit
          ="%s"%(sys.argv[3])


          bmug
          =lambda str : unicode(str).encode("utf8")

          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


          for tnum in range(len(txls)) :
              
          try:
                  sheetname
          =txls[tnum][0]
                  sheetdata
          =txls[tnum][1]
                  
          for tnum in range(max([tmp[0] for tmp in sheetdata])):
                      
          try :
                          stmp
          =str(tnum+1)+tsplit
                          
          for tmp in findcols :
                              stmp
          +=sheetdata[(tnum,cfsize(tmp))]+tsplit
                          
          print stmp
                      
          except:
                          
          print sys.exc_info()[0]
                          
          pass
              
          except:
                  
          print sys.exc_info()[0]
                  
          pass

          print 'close' 


          整理 www.aygfsteel.com/Good-Game
          posted on 2009-06-11 13:18 劉凱毅 閱讀(1228) 評論(0)  編輯  收藏 所屬分類: python
          主站蜘蛛池模板: 长白| 长乐市| 汝阳县| 来安县| 利津县| 来宾市| 高平市| 沂源县| 高要市| 同德县| 邢台县| 大宁县| 彰武县| 资溪县| 平湖市| 巴南区| 共和县| 汉中市| 峨眉山市| 天峻县| 十堰市| 乐安县| 和田县| 陆丰市| 岱山县| 潞西市| 龙游县| 平果县| 梨树县| 苍山县| 平山县| 舟山市| 龙陵县| 长阳| 汉川市| 叙永县| 徐水县| 兴安盟| 黄骅市| 晋中市| 崇文区|