From 9f975d42e8a1deca182270642c365ba11f565259 Mon Sep 17 00:00:00 2001 From: "dn337t@gmail.com" Date: Wed, 20 Jun 2012 20:25:35 +0000 Subject: [PATCH] simplified findbits.invert() --- tools/findbits.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/tools/findbits.py b/tools/findbits.py index 03e0c4e0..6562f776 100755 --- a/tools/findbits.py +++ b/tools/findbits.py @@ -26,15 +26,7 @@ import string # invert binary string def invert(data): - i= 0 - out= '' - while(i < len(data)): - if data[i] == '0': - out += '1' - else: - out += '0' - i += 1 - return out + return ''.join('0' if c == '1' else '1' for c in data) # do the actual search def search(target,data): -- 2.39.5