How to sort out the list containing ip addresses? | Sololearn: Learn to code for FREE!
0

How to sort out the list containing ip addresses?

I have a list a=[192.168.3.4, 23.45.5.67, 192.168.4.6,10.1.1.1]. I should sort this list in the ascending order so that 10.1.1.1 come first and 192.168.4.6 comes at the end of the list. how to achieve that? list.sort() method won't work here.

1st Mar 2017, 5:07 AM
Jayabalan Bala
Jayabalan Bala - avatar
5 Answers
1st Mar 2017, 11:32 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 6
BTW, I have fine-tuned the sorting in this code, as I found some flaws in it.
5th Mar 2017, 8:47 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
Try by yourself: I kindely answered your previous question... you must study, search by yourself on ressources available on internet in references, forums and tutorials, and then ask here for more specific question, posting your code attempt and being as accurate as you can by describing your problem ^^
1st Mar 2017, 7:08 PM
visph
visph - avatar
0
hey visph. I have this task as part of my large assignment. I dunno if u knew this. sorting a simple list will work out easy. but sorting a list with IP addresses is very advanced. I have to retrieve only a particular column of destination IP addresses from a wireshark capture file and then I have to sort it and save it as a text file. I have achieved everything above except the sorting part. I have searched in Internet but very few sites have discussed about this. and I didn't understand in those sites. I am not supposed to use any other external modules other than inbuilt. so it is a challenging
1st Mar 2017, 7:12 PM
Jayabalan Bala
Jayabalan Bala - avatar
- 1
adding to the above I am just using Python as a tool to solve some of my network problems
1st Mar 2017, 7:12 PM
Jayabalan Bala
Jayabalan Bala - avatar