python 处理电子表格(前编)

import xlrd

input_ip = raw_input("请输入一个ip:")

input_count_values = int(raw_input("请输入-1 or +1 :"))



data = xlrd.open_workbook('d:\\1.xls')

table_Sheet1 = data.sheet_by_name(u'Sheet1')

Sheet1_nrows = table_Sheet1.nrows

Sheet1_ncols = table_Sheet1.ncols

#print type(table_Sheet1.row_values(0))

#print type(table_Sheet1.cell(0,0).value)

x = 0

for y in range(Sheet1_nrows):

    if input_ip in table_Sheet1.cell(y,0).value:

        print "FIND"

        ip_y = y

        print table_Sheet1.row_values(ip_y)

        if table_Sheet1.row_values(ip_y)[-1] > 0 or input_count_values == +1:

            table_Sheet1_updata_row_values = table_Sheet1.row_values(ip_y)[:]

            table_Sheet1_updata_row_values[-1] = table_Sheet1_updata_row_values[-1] + input_count_values

            print  table_Sheet1_updata_row_values[-1]

        else:

            print "last_values=0 cannot -1" 

        break


你可能感兴趣的:(python,import,电子)