Use the key argument with sort()

This commit is contained in:
Guillaume Valadon 2018-01-28 16:33:13 +01:00
parent 364ea44f75
commit 25f68d0eee
1 changed files with 2 additions and 2 deletions

View File

@ -182,8 +182,8 @@ def get_working_ifaces():
os.close(fd)
# Sort to mimic pcap_findalldevs() order
interfaces.sort(lambda ifname_left_and_ifid_left,
ifname_right_and_ifid_right: ifname_left_and_ifid_left[1]-ifname_right_and_ifid_right[1])
interfaces.sort(key=lambda elt: elt[1])
return interfaces