Hello! help me with my problem there is a script that addresses mysql to the database and with the help of the query pulls out the following data from the database: Dlink DES-3028 orb.001.prolet.151.sa1 10.0.0.78, this whole line, I need to extract output the result of the script only this part of the orb.001.prolet.151.sa1 line, please tell me how to do this, for I am new to python.

  • And you could not describe in words what part of the query result you need? Those. it is always the third word (separation by spaces), the last word or something else. Or do you need to drop "Dlink DES-3028" everywhere? - alexlz

1 answer 1

As I understand the line consists of "equipment" "Domain" "IP", if so then we can do so

s = "Dlink DES-3028 orb.001.prolet.151.sa1 10.0.0.78" print s.split(' ')[-2]