Skip to content

Instantly share code, notes, and snippets.

@katryo
Created January 17, 2014 05:49
Show Gist options
  • Save katryo/8468975 to your computer and use it in GitHub Desktop.
Save katryo/8468975 to your computer and use it in GitHub Desktop.
Convert quotations for tex.
if __name__ == '__main__':
left_double_quotation = '“'
right_double_quotation = '”'
single_quotation = '’'
result = str()
with open('word_to_tex.txt', 'r') as f:
for row in f:
row = row.replace(left_double_quotation, '``')
row = row.replace(right_double_quotation, "''")
row = row.replace(single_quotation, "'")
result += row
with open('eguide.tex', 'w') as f:
f.write(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment