Issue in parsing the strings in python code
Brian Oney
brian.j.oney at googlemail.com
Mon Nov 12 09:34:25 EST 2018
On Mon, 2018-11-12 at 14:17 +0000, Rhodri James wrote:
> On 12/11/2018 09:37, srinivasan wrote:
> > Because the problem is every time when ever I see the output using the
> > "nmcli c show", the below output is the weird output, so instead of
> > connecting to SSID "NIFunkloch" it randomly connects to "NIFunkloch 1552"
> > or sometimes to NIFunkloch 1000" or so on
> >
> > root:~/qa/robot_tests# nmcli c show
> > NAME UUID TYPE DEVICE
> >
> > NIFunkloch 1552 c8e1e8c0-0f25-4299-a9ae-2910cfef2ebd wifi wlp1s0
> >
> > Wired connection 1 2a14fbe6-58a0-3b7f-b986-5d1b36a94ec0 ethernet
> > enp0s21f0u4
> > NIFunkloch 1da7d068-4548-4446-bf88-a440e49db1b1 wifi --
>
> [snipped for brevity]
>
> That looks conveniently aligned. Can't you just slice each line to get
> the entries you are after?
>
I believe the idea is to allow the help seeker to piece the following puzzle together.
$ nmcli -t NAME,SOMETHINGELSE c show
>>> help(subprocess.Popen)
>>> text.split(':')
>>> aarrr.shiver_me(timbers) if "I am" in "the Bermuda triangle" else help("where")
More information about the Python-list
mailing list