use the power, luke!
aside from various networking libraries out there, the problem is rather
simple....
what you're getting back is the "alphabetical order" .
what you need instead is to sort every triplet as an integer.
In reality, python strings for ip addresses are good enough, if taken
separately, i.e.
1 is lower than 10 even if "1" and "10" are strings.
so, to order your ip addresses, you just split every ip address by "."
given a list of
myips = [
'192.168.4.1',
'192.168.1.10',
'192.168.1.11',
]
what_you_want = sorted(myips, key=lambda x: x.split('.'))
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.