Skip to content

Instantly share code, notes, and snippets.

@fabiomontefuscolo
Created February 26, 2014 17:40
Show Gist options
  • Save fabiomontefuscolo/9234485 to your computer and use it in GitHub Desktop.
Save fabiomontefuscolo/9234485 to your computer and use it in GitHub Desktop.
remove obsfucação dos arquivos do dicionário houaiss
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#
# Coloque esse script na pasta com os arquivos dhx.
# O resultado estará em iso-8859-1
#
#
# Segui o tutorial em http://www.caloni.com.br/blog/archives/conversor-de-houaiss-para-babylon-parte-1
#
import os
files = os.listdir('.')
for arq in files:
if not arq.endswith('dhx'):
continue
print 'Abrindo "%s"' % arq
origin = open(arq, 'r')
target = open('%s.txt' % arq, 'w+')
char = origin.read(1)
while char:
byte = ord(char) + 0x0B
new_char = chr(byte % 256)
target.write(new_char)
char = origin.read(1)
origin.close()
target.close()
@apompeia
Copy link

apompeia commented Apr 6, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment