I have an excel file that contains some required parameters and their values and I am trying to feed them into the __init__
function of my class entity. I know the below must be setting self.key
to each value in turn, but should I be "masking"(?) the .key
?:
class Customer:
def __init__(self):
for key, value in zip(excelDF.attribs, excelDF.values):
if key!=None and value !=None:
self.key= value
To give an example of what I am trying for:
excelDF.attribs=['name','telephone']
excelDF.values=['Tom','01234-567890']
customer1=Customer()
print(customer1.name)
print(customer1.telephone)
gives...
Tom
01234-567890