Tim Roberts wrote: > pierre baral wrote: >> In fact, I would like to generate a code that is generic... without >> knowing the name of the properties (so without calling obj.property) ! >> >> Check my example: >> >> c = wmi.WMI() >> wql = "Select Name, Caption, Description From Win32_Blabla" >> objs = c.query(wql) >> >> for obj in objs: >> props = [getattr(obj, p) for p in obj.properties] >> print "%s" % (";" . join ([p for p in props])) >> >> Actually it will print the props list with the obj.properties order >> (not the order >> of my request) >> >> Any tips to keep the order of my request? So It's not possible? ;'( > Not possible. You will have to pass the field ordering from the query > along to the renderer somehow.
c = wmi.WMI() flds = ('Name','Caption','Description') wql = 'Select ' + ','.join(flds) + ' From win32_blabla' objs = (flds,c.query(wql)) ... for obj in objs[1]: props = [getattr(obj,p) for p in objs[0]] print ';'.join(props) -- Tim Roberts, t...@probo.com Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32