Created
September 12, 2019 17:57
-
-
Save blurbdust/d1812471944d3bf61bbab857343c042c to your computer and use it in GitHub Desktop.
minimum of 15 charcters from kwp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/env/user/python3 | |
import sys | |
def main(infile, outfile, minlength): | |
#print(minlength) | |
minlength = int(minlength) | |
with open(outfile, "w") as out: | |
with open(infile, "r") as in_: | |
for line in in_: | |
line = line.replace("\n", "").replace("\r", "").replace("\t", "").replace(" ", "") | |
sum = 1 | |
for char in line: | |
sum += int("0x" + char, 16) | |
if (sum >= minlength): | |
#print(line) | |
out.write(line + "\n") | |
if __name__ == '__main__': | |
if len(sys.argv) < 3: | |
print("Useage: {} input_route modified_route minlnegth".format(sys.argv[0])) | |
else: | |
main(sys.argv[1], sys.argv[2], sys.argv[3]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment