I'm trying to create a Python (2.7) function that will take a string and return true if its input is an ip address, possibly with a slash in the end, but false otherwise. It needs to return a false value if the string is not just an ip address, but an ip address followed by some sort of path. It doesn't matter if the address is a valid IP or not (999.999.999.999 can be considered an ip address for that matter).
eg: "124.131.141.248" - true "124.131.141.248/" - true "124.131.141.248/bla" - false "hello world" - false
I've tried searching for a solution but most solutions include just checking for a valid IP address, disregarding my other needs.
Any help would be appreciated.
Thanks,