Skip to content

Instantly share code, notes, and snippets.

@quasarj
Created May 26, 2015 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quasarj/ffd82a3c7e348e7b3ce3 to your computer and use it in GitHub Desktop.
Save quasarj/ffd82a3c7e348e7b3ce3 to your computer and use it in GitHub Desktop.
def axe_quotes(line):
if '"' not in line:
return line
brackets = 0
out = ""
for c in line:
if c == '<':
brackets += 1
elif c == '>':
brackets -= 1
elif c == '"' and brackets:
c = '%22'
out += c
return out
with open("ttest.txt") as infile:
with open("tout.txt", "w") as outfile:
for line in infile:
outfile.write(axe_quotes(line))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment