Python Forum
How to parse std out? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to parse std out? (/thread-37789.html)



How to parse std out? - ilknurg - Jul-22-2022

I want to parse the output below. I want to get IP Address line.

__GENUS          : 2
__CLASS          : Win32_NetworkAdapterConfiguration
__SUPERCLASS     : 
__DYNASTY        : 
__RELPATH        : 
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         : 
__NAMESPACE      : 
__PATH           : 
IPAddress        : {192.168.1.16, fe80::801:8181:f074:bcda}
PSComputerName   : 
I tried this code but it doesnt give me any result.


print(result.std_out)
for line in result.std_out:
    if "IPAddress" in line:
        print(line)



RE: How to parse std out? - Larz60+ - Jul-22-2022

Perhaps the entire process can be done from within python.
To do this, we need a complete spec for the process.