예제 #1
0
def highlight_columns(sheetname):
    dif_items = get_dif_columns(sheetname)
    excel = Excel(settings.TGT_FILE_PATH)
    wb = excel.get_wb()
    ws = excel.get_sheet(sheetname)
    max_row = excel.get_max_row(sheetname)
    col_hdr = []
    for dif_col in dif_items:
        col_hdr_item = excel.convert_col2header(sheetname=sheetname,
                                                column_name=dif_col)
        col_hdr.append(col_hdr_item)

    #print(col_hdr)

    # for row_nbr in range(1,max_row-490):
    #     for hdr in col_hdr:
    #         cell_item = hdr+str(row_nbr)
    #         print(cell_item)
    #         cell_item.fill = openpyxl.styles.fills.Color.
    #         ws[cell_item].fill = colors.RED
    #
    # wb.save('new_compare_result.xlsx')

    for item in get_dif_columns(sheetname):
        cells = excel.get_column(sheetname, column_name=item)
        print(cells)
        for cell in cells:
            cell.fill = PatternFill(patternType='solid', fgColor='00FF0000')

    wb.save('new_compare_result.xlsx')
예제 #2
0
            if con.acquire():
                if len(queue) < 0:
                    con.wait()
                else:
                    elem = queue.pop()
                    print("Consumer a elem {}. Now size is {}".format(
                        elem, len(queue)))
                    time.sleep(random.random())
                    con.notify()
                con.release()


def main():
    for i in range(3):
        Producer().start()

    for i in range(2):
        Consumer().start()


if __name__ == '__main__':
    from lib.excel import Excel
    from utils import settings
    for path, sheetnames in settings.SRC_DATA.items():

        excel = Excel(path)
        sheet = excel.get_sheet(sheetnames[0])
        for _i, _row in enumerate(sheet.rows):
            _t = excel.get_column(sheet, 'Year')
            print(1)