Issue in parsing the strings in python code

srinivasan srinivasan.rns at gmail.com
Mon Nov 12 14:52:23 EST 2018


Hi Thomas,

I have Implemented as below, please let me know if you forsee any issues in
the below code snippet?    as I have just started learning python from last
week


def wifi_connect_verify(self):
        """
            Verify Connectivity of WIFI module to the Access.

            :return: command output as True or False.
        """

*        cmd = 'nmcli dev | grep "wlp1s0" | grep "connected"'*
*        f = os.popen(cmd)*
*        if 'connected' in f.read().strip():*
*            return True*
*        else:*
*            return False*

Kindly do the needful
Srini

On Mon, Nov 12, 2018 at 4:02 PM Thomas Jollans <tjol at tjol.eu> wrote:

> On 2018-11-12 10:23, srinivasan wrote:
> > Hi Thomas,
> >
> > Great to hear from you, Could you please let me know how do I get the
> UUID
> > "1da7d068-4548-4446-bf88-a440e49db1b1" by passing the name of the SSID
> > "Funkloch' using "nmcli --terse" ??
>
>
> Have a look at the output. It appears to me that the fields are
> separated by colons, so you should be able to split each line on ':'.
>
> If you're stuck, let us see what you've tried!
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list