I need to parse some text file, create objects for various entities encountered in the text, and put them in some data structure (e.g., a list) for further processing. Example of the text:
laptop
17" dell, weight: 12 lb
desktop
24" hp
I know in advance which entities may exist in the text, and what attributes they are supposed to have. In this example, I would already have classes laptop and desktop defined (probably subclasses of class computer). The parser would just need to create objects laptop('dell', 17, 12), and dekstop('hp', 24).
If I follow this route, I would need to retrieve class names from strings, and create objects of those classes. Is it the Pythonic way of doing things? If so, what's the best approach (using Python 3.1)? If not, what should I do instead?
Thanks!
What