Hello! Can somebody help with my programming course work? Basically I am creating a class for few details of a house which i then append it in to a list and finally add into a text file. When I open the file it prints like this e.g. Jackson, 12, 4, 4 If I have many lines of data in a text file, how can i convert these values back into the details of class as they were before the addition into a list. e.g Jackson, 12, 4, 4 Brown, 23, 34, 4
I want to print all this like we do in class files so that I can use this data for later calcultation. Variables are inserted in a loop so the number of inputs can be any.
Thank you in advance! Here is m
def loadFile(): try: h = input("Give the filename to open: ") t1 = open(h, "r") talo2 = Talo() while True: line = t1.read() if len(line)> 0: print(rivi)
if len(rivi)== 0: print("Files are loaded") list.append(talo2) break except nameError: print("File does not exist") return lista