Pastebin

Paste #2542: None

< previous paste - next paste>

Pasted by tdn@barbera

Download View as text

a = """Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Speed: 10Mb/s
        Duplex: Half
        Port: MII
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: pumbg
        Wake-on: g
        Current message level: 0x00000033 (51)
                               drv probe ifdown ifup
        Link detected: no"""

a = ""
iface = "eth0"

lines = a.split("\n")
for line in lines:
    line = line.strip()
    if line.startswith("Link detected"):
        print line.split(":")[1].strip() == "yes"
    else:
        print "FAlse"

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.