How to make abstract Python class from string? -
i'm working on module saved users' data onto parse.com cloud. using parse.py library, need this:
class cat: pass cat = cat() cat.name = 'alice' cat.save()
where cat
name of table in cloud.
possible somehow create class dynamically string not having anywhere else before?
here suggested, there's module pre-defined class.
here eval
used on pre-defined class.
so, it possible create class dynamicallly in runtime string? like:
save_data('alice','myclass') def upload(cat_name, class_name): class_name.name = cat_name class_name.save()
Comments
Post a Comment