Skip to content

Instantly share code, notes, and snippets.

@lucasverra
Created December 13, 2015 13:44
Show Gist options
  • Save lucasverra/cfd3dd6990bc4e90c2ec to your computer and use it in GitHub Desktop.
Save lucasverra/cfd3dd6990bc4e90c2ec to your computer and use it in GitHub Desktop.
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