Skip to content

Instantly share code, notes, and snippets.

@kcarnold
Forked from anonymous/dequote.py
Created December 13, 2012 22:29
Show Gist options
  • Save kcarnold/4280667 to your computer and use it in GitHub Desktop.
Save kcarnold/4280667 to your computer and use it in GitHub Desktop.
import sys
tr = [
(u'\u2018', "`"),
(u'\u2019',"'"),
(u'\u201c', "``"),
(u'\u201d', "''")
]
s = sys.stdin.read().decode('utf8')
for a, b in tr:
s = s.replace(a, b)
sys.stdout.write(s.encode('latin1'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment