The start parameter for enumerate()

Since python version 2.6 the start parameter was added and can be used
This commit is contained in:
deix
2017-08-28 18:14:09 +02:00
parent 00e5246f96
commit dbc0d995e3
5 changed files with 12 additions and 14 deletions

View File

@@ -74,11 +74,11 @@ class CrackHandshake(object):
Color.p(" " + ("-" * 17))
Color.p(" " + ("-" * 19) + "\n")
# Print all handshakes
for index, hs in enumerate(handshakes):
for idx, hs in enumerate(handshakes, start=1):
bssid = hs["bssid"]
essid = hs["essid"]
date = datetime.strftime(datetime.fromtimestamp(hs["date"]), "%Y-%m-%dT%H:%M:%S")
Color.p(" {G}%s{W}" % str(index + 1).rjust(3))
Color.p(" {G}%s{W}" % str(idx).rjust(3))
Color.p(" {C}%s{W}" % essid.ljust(max_essid_len))
Color.p(" {C}%s{W}" % bssid)
Color.p(" {C}%s{W}\n" % date)