[python-win32] wmi query.
Tim Golden
mail at timgolden.me.uk
Tue Mar 25 15:04:15 CET 2008
Tim Golden wrote:
[... snip other examples ...]
> Even that is a slight optimisation. It usually costs little
> to pull back all the fields, so I generally write:
>
> <code>
> import wmi
>
> c = wmi.WMI ()
> for service in c.Win32_Service (state="Stopped"):
> print c.Caption, c.Status
>
> </code>
Sorry. I nearly always drop my samples into the interpreter
before pressing [Send]. And this is why! That should have been:
<code>
import wmi
c = wmi.WMI ()
for service in c.Win32_Service (state="Stopped"):
print service.Caption, service.Status
</code>
(And I actually ran it this time).
TJG
More information about the python-win32
mailing list