Created
December 13, 2015 13:44
-
-
Save lucasverra/cfd3dd6990bc4e90c2ec to your computer and use it in GitHub Desktop.
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
import re | |
d2 = 0 | |
cumul_raw = 0 | |
with open('instru.txt', 'r') as f: | |
for line in f: | |
line=line.rstrip() | |
d2+=4 | |
cumul_raw+=len(line) | |
print line | |
for i in range(1,len(line)-1): | |
print d2 | |
if line[i] == "\\" : | |
if line[i+1] == "\"" and (not line[-2]=='\\'): | |
d2+=2 | |
elif line[i+1] == '\\' and (not line[i-1] == '\\'): | |
d2+=2 | |
elif line[i+1] == "x": | |
if re.findall(r'[a-f0-9]{2}',line[i+2:i+4]): | |
d2+=1 | |
print d2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment