I apologise if this question has already been asked.
I'm really new to Python programming, and what I need to do is this: I have a .csv file in which each line represent a person and each column represents a variable. This .csv file comes from an agent-based C++ simulation I have done. Now, I need to read each line of this file and for each line generate a new instance of the class Person(), passing as arguments every variable line by line.
My problem is this: what is the most pythonic way of generating these agents while keeping their unique ID (which is one of the attributes I want to read from the file)? Do you suggest creating a class dictionary for accessing every instance? But I still need to provide a name to every single instance, right? How can I do that dynamically? Probably the best thing would be to use the unique ID, read from the file, as the instance name, but I think that numbers can't be used as instance names, can they? I miss pointers! :(
I am sure there is a pythonic solution I cannot see, as I still have to rewire my mind a bit to think in pythonic ways... Thank you very much, any help would be greatly appreciated! And please remember that this is my first project in python, so go easy on me! ;)
EDIT: Thank you very much for your answers, but I still haven't got an answer on the main point: how to create an instance of my class Person() for every line in my csv file. I would like to do that automatically! Is it possible? Why do I need this? Because I need to create networks of these people with networkx and I would like to have "agents" linked in a network structure, not just dictionary items.