Answer the question
In order to leave comments, you need to log in
What is the correct way to pass objects in python?
Good afternoon.
there are three .py files in my program
main, database, classes
database:
list_of_objects = []
def read():
f = open('data.txt')
pocet_bytu = int(f.readline())
for a in range(pocet_bytu):
byt1 = byt.Byt(f.readline()) #declaration of object with name
byt1.is_a = f.readline()
byt1.adresa = f.readline()
byt1.majitel = f.readline()
list_of_objects.append(byt1)
if __name__ == '__main__':
database.read()
print(len(database.list_of_objects))
print(bdatabase.list_of_objects[0].data_for_print())
print(bdatabase.list_of_objects[0])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question