É um programa que lê planilha do Excel com lançamentos de débito e crédito em uma conta.
abreexcel2.py
def leplanilha():
wb1 = oxl.load_workbook('extratomar2018.xlsx')
folhas=wb1.get_sheet_names()
print(folhas)
sheet=wb1.get_sheet_by_name('plan1')
nr=sheet.max_row
nc=sheet.max_column
for rw in range(2,nr+1):
if sheet['D'+str(rw)].value in lista:
pass
else:
lista.append(sheet['D'+str(rw)].value)
print(lista)
leplanilha():
Gerou a seguinte lista:
['TEDSALARIO', 'APLIC POUP', 'CP MAESTRO', 'DOC ELET', 'DEB.IOF', 'SAQUE B24H', 'PAG FONE', 'PG PREFEIT', 'PAG AGUA', 'PAG BOLETO', 'ENVIO TEV', 'DEP CH 24H', 'CRED TED', 'RESG POUP', 'DOC ELET E', 'DEB CESTA', 'CHEQ COMP', 'SAQUE ATM', 'PG LUZ/GAS']
Pergunta: gostaria de gerar uma lista automaticamente, tendo como nome cada um desses elementos dessa lista, para preenchê-los, com os respectivos lançamentos, mas não consigo.
Como gerar uma variável tendo como nome um item de uma lista?