challenge #0
your function is given a string with an IP address possibly in there somewhere. if there is no IP address, then just return None or raise an exception. if there is an IP address, return a tuple with:
#0: where the first IP address starts in the string
#1: where the first IP address ends in the string
these 2 numbers are suitable for slicing the string to split the parts.
bonus: support multiple IP addresses (what should be returned?)
bonus: support IPv6 (what should be returned?)
challenge #1
write a program/script to sort the lines of a file by IP address as found by the function in the above challenge. be sure that 10.9.9.9 comes before 172.16.8.8
bonus: accept an argument/option to specify the index of which IP address is to be the sort key
bonus: support IPv6 (how will you collate IPv4-in-IPv6 relative to IPv4?)
your function is given a string with an IP address possibly in there somewhere. if there is no IP address, then just return None or raise an exception. if there is an IP address, return a tuple with:
#0: where the first IP address starts in the string
#1: where the first IP address ends in the string
these 2 numbers are suitable for slicing the string to split the parts.
bonus: support multiple IP addresses (what should be returned?)
bonus: support IPv6 (what should be returned?)
challenge #1
write a program/script to sort the lines of a file by IP address as found by the function in the above challenge. be sure that 10.9.9.9 comes before 172.16.8.8
bonus: accept an argument/option to specify the index of which IP address is to be the sort key
bonus: support IPv6 (how will you collate IPv4-in-IPv6 relative to IPv4?)
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.