запись переменных в цикле

у меня есть 2 функции, в одно происходит парсинг excel таблицы, в другой должен передаваться диапазон ячеек в первую функцию и происходить запись в переменных текста, который парсится из таблицы(в первой функции), с каждым циклом меняется диапазон и записывается уже другая переменная и так повторяется всего несколько раз, я написал небольшой код, но он не работает, прошу помощи у вас, надеюсь вы сможете мне помочь, заранее спасибо

def get_schedule(number, group_name: str = '', course_name: str = '') -> dict:
    monday, tuesday, wendesday, thursday, friday, saturday = None, None, None, None, None, None
    # monday22, tuesday22, wendesday22, thursday22, friday22, saturday22 = None, None, None, None, None, None
    cells_all(name_days)
    schedule = {}
    if course_name == '2 курс':
        book = openpyxl.open('2-kurs-mkvvr3ew.xlsx', read_only=True)
        sheet = book.active
        if group_name == 'АМ-1-19':
            name_days = ['monday', 'tuesday', 'wendesday', 'thursday', 'friday', 'saturday']
            for i in name_days:
                while i!=6:
                    i+=1
                    n=10
                    h=21
                    cells = sheet[f'F{n}':f'I{h}']
                    n+=12
                    h+=12
                    name_days = number

это было присваивание переменных

def cells_all(cells):
    k = 1
    for i in range(len(cells) - 1):
        cell_value = [cell.value for cell in cells[i]]
        cell = parse_cell(cell_value)
        second_cell = None
        second_cell = [cell_.value for cell_ in cells[i + 1]]
        second_cell = parse_cell(list(second_cell))
        if len(cell['cabinets']) == 1 and len(cell['subjects']) == 1 and not(len(cell['names'])) and not(cell_value[1] is None and cell_value[2] is None):
            if cell_value[0] is None and cell_value[1] is None:
                first_group = True
            else:
                first_group = False
            text = pretty_group_cells(cell, second_cell, first_group)
            i += 1
            number = (k, ')', text)
            k += 1
            continue
        elif len(cell['cabinets']) > 1:
            if cell['subjects'] and second_cell['names']:
                text = pretty_group_cells(cell, second_cell)
                i += 1
                number =(k, ')', text)
                k += 1
            continue
        elif len(cell['cabinets']) == 1 or cell['subjects']:
            if second_cell['names'] and cell['subjects']:
                text = pretty_base_cell(cell, second_cell)
                i += 1
                number = (k, ')', text)
                k += 1
        else:
            if not(cell['names']):
                text = pretty_not_cells()
                if k == 3 or k==4 or k==5 or k==6 or k==7 or k==8:
                    k -= 1
                else:
                    number = (k, ')', text)
                    i += 1
                    k += 2
    return cells_all

а это функция записи в переменные текста


Ответы (0 шт):