Exemplo n.º 1
0
 def __init__(self, filename, sheetnumber, share1, month):
     self.wb = open_workbook(filename, formatting_info=True)
     # 0铁塔 1基站
     self.s = self.wb.sheets()[sheetnumber]
     self.share1 = Utils.col_by_name(share1)
     self.share2 = self.share1 + 1
     self.month = Utils.col_by_name(month)
     print "Sheet:", self.s.name
Exemplo n.º 2
0
 def __init__(self, filename):
     self.wb = open_workbook(filename, formatting_info=True)
     self.s = self.wb.sheets()[1]
     self.datecol = Utils.col_by_name('B')   #日期
     self.owner = Utils.col_by_name('M')     #主建方
     self.receiver = self.owner + 1          #共享方
     self.sharetype = Utils.col_by_name('O') #共享/共建
     self.TieTaType = Utils.col_by_name('I') #铁塔类型
     self.height    = Utils.col_by_name('J') #高度
     print 'Sheet:',self.s.name
Exemplo n.º 3
0
# -*- coding: UTF-8 -*- 
#!/bin/python

import re 

from xlrd import open_workbook
from xlwt import Utils

#WCDMA xiaoqu DATABASE
print 'loading xiaoqu'
wdb_book = open_workbook("xiaoqu.xlsx")
wdb = wdb_book.sheet_by_index(0)
wdb_names = []
for i in range(1, wdb.nrows):
    new_id = wdb.cell(i, Utils.col_by_name('D') ).value
    new_record = {}
    new_record["line_number"] = i
    new_record["nodebid"] = int(new_id)
    wdb_names.append( new_record)
print `len(wdb_names)` + " xiaoqu"

#WCDMA automatch
print 'loading automatch'
wbbu_book = open_workbook("automatch.xls")
wbbu = wbbu_book.sheet_by_index(0)
wbbu_names = []
for i in range(1, wbbu.nrows):
    new_id = wbbu.cell(i, Utils.col_by_name('C') ).value
    new_record = {}
    new_record["line_number"] = i
    new_record["nodebid"] = int(new_id)
Exemplo n.º 4
0
from xlwt import Utils

print 'AA ->',Utils.col_by_name('AA')
print 'A ->',Utils.col_by_name('A')

print 'A1 ->',Utils.cell_to_rowcol('A1')
print '$A$1 ->',Utils.cell_to_rowcol('$A$1')

print 'A1 ->',Utils.cell_to_rowcol2('A1')

print (0,0),'->',Utils.rowcol_to_cell(0,0)
print (0,0,False,True),'->',
print Utils.rowcol_to_cell(0,0,False,True)
print (0,0,True,True),'->',
print Utils.rowcol_to_cell(
          row=0,col=0,row_abs=True,col_abs=True
          )

print '1:3 ->',Utils.cellrange_to_rowcol_pair('1:3')
print 'B:G ->',Utils.cellrange_to_rowcol_pair('B:G')
print 'A2:B7 ->',Utils.cellrange_to_rowcol_pair('A2:B7')
print 'A1 ->',Utils.cellrange_to_rowcol_pair('A1')

print (0,0,100,100),'->',
print Utils.rowcol_pair_to_cellrange(0,0,100,100)
print (0,0,100,100,True,False,False,False),'->',
print Utils.rowcol_pair_to_cellrange(
          row1=0,col1=0,row2=100,col2=100,
          row1_abs=True,col1_abs=False,
          row2_abs=False,col2_abs=True
          )
Exemplo n.º 5
0
def tail_match(s,t):
    s = re.sub(u'_高铁$', '', s)
    t = re.sub(u'_高铁$', '', t)
    s = re.sub(u'居委会$','', s)
    t = re.sub(u'居委会$','', t)
    return s[-1] == t[-1] and s[-2] == t[-2]

#WCDMA BASIC DATABASE
print 'loading wdb'
wdb = open_workbook("wdb.xlsx").sheet_by_index(0)
wdb_names = []
last_name = ""
for i in range(1, wdb.nrows):
    new_name = wdb.cell(i,9).value
    lac = wdb.cell(i, Utils.col_by_name('G') ).value
    nodebid  = int( wdb.cell(i, Utils.col_by_name('BF') ).value )
    if new_name == last_name:
        continue
    new_record = {}
    new_record["line_number"] = i
    new_record["nodebid"] = nodebid
    new_record["orig_string"] = new_name
    new_record["lac"] = lac
    last_name = new_name
    new_name = re.sub(u'^泉州|\s','',new_name)
    new_name = re.sub(u'\$.*$','',new_name)
    new_name = re.sub(u'_BBU[0-9]?', '' , new_name)
    new_name = re.sub(u'_TEST', '', new_name)
    new_name = re.sub(u'_临时', '', new_name)
    new_name = re.sub(u'_[0-9]+$','',new_name)
Exemplo n.º 6
0
from xlwt import Utils

print 'AA ->', Utils.col_by_name('AA')
print 'A ->', Utils.col_by_name('A')

print 'A1 ->', Utils.cell_to_rowcol('A1')
print '$A$1 ->', Utils.cell_to_rowcol('$A$1')

print 'A1 ->', Utils.cell_to_rowcol2('A1')

print(0, 0), '->', Utils.rowcol_to_cell(0, 0)
print(0, 0, False, True), '->',
print Utils.rowcol_to_cell(0, 0, False, True)
print(0, 0, True, True), '->',
print Utils.rowcol_to_cell(row=0, col=0, row_abs=True, col_abs=True)

print '1:3 ->', Utils.cellrange_to_rowcol_pair('1:3')
print 'B:G ->', Utils.cellrange_to_rowcol_pair('B:G')
print 'A2:B7 ->', Utils.cellrange_to_rowcol_pair('A2:B7')
print 'A1 ->', Utils.cellrange_to_rowcol_pair('A1')

print(0, 0, 100, 100), '->',
print Utils.rowcol_pair_to_cellrange(0, 0, 100, 100)
print(0, 0, 100, 100, True, False, False, False), '->',
print Utils.rowcol_pair_to_cellrange(row1=0,
                                     col1=0,
                                     row2=100,
                                     col2=100,
                                     row1_abs=True,
                                     col1_abs=False,
                                     row2_abs=False,
from xlwt import Utils

print Utils.col_by_name('AA')
print Utils.col_by_name('A')

print Utils.cell_to_rowcol('A1')
print Utils.cell_to_rowcol('$A$1')

print Utils.cell_to_rowcol2('A1')

print Utils.rowcol_to_cell(0,0)
print Utils.rowcol_to_cell(0,0,False,True)
print Utils.rowcol_to_cell(
    row=0,col=0,row_abs=True,col_abs=True
    )

print Utils.cellrange_to_rowcol_pair('1:3')
print Utils.cellrange_to_rowcol_pair('B:G')
print Utils.cellrange_to_rowcol_pair('A2:B7')
print Utils.cellrange_to_rowcol_pair('A1')

print Utils.valid_sheet_name('')
print Utils.valid_sheet_name("'quoted'")
print Utils.valid_sheet_name("O'hare")
print Utils.valid_sheet_name("X"*32)
print Utils.valid_sheet_name("[]:\\?/*\x00")
Exemplo n.º 8
0
from xlwt import Utils

print Utils.col_by_name('AA')
print Utils.col_by_name('A')

print Utils.cell_to_rowcol('A1')
print Utils.cell_to_rowcol('$A$1')

print Utils.cell_to_rowcol2('A1')

print Utils.rowcol_to_cell(0, 0)
print Utils.rowcol_to_cell(0, 0, False, True)
print Utils.rowcol_to_cell(row=0, col=0, row_abs=True, col_abs=True)

print Utils.cellrange_to_rowcol_pair('1:3')
print Utils.cellrange_to_rowcol_pair('B:G')
print Utils.cellrange_to_rowcol_pair('A2:B7')
print Utils.cellrange_to_rowcol_pair('A1')

print Utils.valid_sheet_name('')
print Utils.valid_sheet_name("'quoted'")
print Utils.valid_sheet_name("O'hare")
print Utils.valid_sheet_name("X" * 32)
print Utils.valid_sheet_name("[]:\\?/*\x00")