So I am trying to make a Python script to analyze geo-location file based on somebody's IP address.
The format is like (i.e.):
"0.0.0.0","0.255.255.255","US","California","Los Angeles"
"1.0.0.0","1.0.0.255","AU","Queensland","Brisbane"
"1.0.1.0","1.0.3.255","CN","Fujian","Fuzhou"
I think that the first column is the IP address and the second one is the subnet mask.
How do I make a script in Python to analyze retrieve the location of the IP address quickly?
I did have an idea but it takes a bit longer than I thought:
I first take the first part of the IP address of the target as a parameter, locating all possibilities of the second part of the starter. Then I locate the second part of the target address and so forth. This method, for sure, is better than looking at the file line by line but I don't think it's the best way to do it.
The data file is attached so please help me. I may not explain it well so bear with me :P