How would I go about removing characters from the left side of a Python string? Example:
string = "Devicename MA:CA:DD:RE:SS"
What should I do to make a new string of just the MAC Address?
You can do different things:
string.split(' ')[1]
or
string[11:]
or
string[-14:]
both yielding
'MA:CA:DD:RE:SS'
The last option is the closest to what you want I suppose. It takes the leftmost 14 characters from the string.
Assuming that the string always has the format:
Devicename<space>MAC Address
You can do this by simply splitting the string on the space and taking the second element in the resulting list.
>>> string = "Devicename MA:CA:DD:RE:SS"
>>> string.split()[1]
'MA:CA:DD:RE:SS'
One note - I assume you know that is not a valid MAC address, correct?