title: Sort on the last octet of an IP address in a Python list
body: <p>Here's a bit of a brain boggler (for me at least). I'm utilizing a simple Python script to return a list of "up" hosts using fping. I'm storing each "up" host in a Python list, however the list.sort() won't obviously sort based on the last octet of the IP address stored as a string. I'd like to sort descending .1, .2, .3, etc.</p>
  
  <p>Here's that portion of the code:</p>
  
  <pre><code>for addr in os.popen("fping -a -q -g " + subnet):
      addr = addr.rstrip('\n')
      addr_list.append(addr)
  
  addr_list.sort()
  for ip in addr_list:
      print ip
  </code></pre>