i have str
in python.
str = "*> 103.5.126.0/24 192.168.1.1 0 200 0 58424 ?"
what want text string , put in variables below:
prefix = "103.5.126.0/24" nexthob = "192.168.1.1" metric = "0" lp = "200"
just split , assign relevant portion:
prefix, nexthob, metric, lp = s.split()[1:5]
i changed variable name s
, str
python type shouldn't shadow.
Comments
Post a Comment