As I assume the text you want to process has some source you might want to look at http://docs.python.org/library/pickle.html ...
2012/1/24 T H <turian9...@gmail.com> > I’m new to python, sorry if my question is a bit naive, I was > wondering if it is possible to parse some text (ie. from a text file > or say html) and then dynamically create a class? > > for example lets say the contents of the text file is: > > functionName: bark arg1: numberBarks > functionName: run arg1: howFast arg2: howLong > > and then from the text dynamically create a class like the one below > (including the functions and its implementation) > > class Dog: > def bark(self, numberBarks, myArg): > print(‘numberBarks: ‘ + numberBarks) > print(‘myArg’ + myArg) > return > def run(self, howFast, howLong, myArg): > print(‘howFast: ‘ + howFast) > print(‘howLong’ + howLong) > print(‘myArg’ + myArg) > return > > I know my question is a bit far fetched. Anyhow if it is possible how > is it done? > Thanks so much for any help! > -- > http://mail.python.org/mailman/listinfo/python-list > -- PGP pub key: http://keyserver.pgp.com/vkd/SubmitSearch.event?SearchCriteria=visgean%40gmail.com http://www.abclinuxu.cz/lide/visgean/gpg A453 B7F3 33D9 3BE6 2B8A | F014 5347 EBAC 0A5A 3E92 Jabber: visg...@jabber.org | visg...@jabber.cz Github: http://github.com/Visgean
-- http://mail.python.org/mailman/listinfo/python-list