You have to split('.')
your string to convert to a list, then reverse it using [::-1]
and join it again adding the .
mystring = "192.168.1.1"
print '.'.join(mystring.split('.')[::-1])
Output:
1.1.168.192
1
solved How to print string array in reverse order in python