class data_array: def __init__(self): # initiates empty lists for each attribute self.number = [] self.code = [] self.connected = [] self.reading = [] self.location = [] self.info_one = [] self.info_two = [] sensor = [None] * 16 for ind in range(0, 16,1): # initiate the attributes sensor[ind] = data_array() for ind in range(0,16,1): # for loop to simulate reading data from a file sensor[ind].number = ind +1 sensor[ind].code = "code" + str(ind +1) sensor[ind].connected = False sensor[ind].reading = 201 + ind sensor[ind].location = " where I found " + str(ind+1) sensor[ind].info_one = " infor_one for sensor " + str(ind+1) sensor[ind].info_two = " infor_two for sensor " + str(ind+1) for ind in range(0,16,1): # check data is accessable as intended print(sensor[ind].number, sensor[ind].code, sensor[ind].connected, sensor[ind].reading, sensor[ind].location, sensor[ind].info_one, sensor[ind].info_two)