Basically I have a file txt.txt
item1, item2
In the code I want to make an object
Object(item1, item2)
And I don’t know how to get item1 and item2 from the file the way I need. I tried to use a file = open("txt.txt").read() string and split it somehow, but failed. Tried putting it in a list and resulted in having [ and other stuff in item1 and item2 strings.
this answer creates a list of objects, the objects are made by iterating over each line in the file and splitting each line into both items, and then using them to construct the object.
a bit more detail about the last line, it can be opened up like this: