Skip to content

Instantly share code, notes, and snippets.

@marcelcaraciolo
Created December 2, 2011 18:09
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcelcaraciolo/1424226 to your computer and use it in GitHub Desktop.
Save marcelcaraciolo/1424226 to your computer and use it in GitHub Desktop.
asciize
d = {192: u'A', 193: u'A', 194: u'A', 195: u'A', 196: u'A', 197: u'A',
199: u'C', 200: u'E', 201: u'E', 202: u'E', 203: u'E', 204: u'I',
205: u'I', 206: u'I', 207: u'I', 209: u'N', 210: u'O', 211: u'O',
212: u'O', 213: u'O', 214: u'O', 216: u'O', 217: u'U', 218: u'U',
219: u'U', 220: u'U', 221: u'Y', 224: u'a', 225: u'a', 226: u'a',
227: u'a', 228: u'a', 229: u'a', 231: u'c', 232: u'e', 233: u'e',
234: u'e', 235: u'e', 236: u'i', 237: u'i', 238: u'i', 239: u'i',
241: u'n', 242: u'o', 243: u'o', 244: u'o', 245: u'o', 246: u'o',
248: u'o', 249: u'u', 250: u'u', 251: u'u', 252: u'u', 253: u'y',
255: u'y'}
def asciize(string_com_acentos):
return string_com_acentos.translate(d)
asciize(u'pé de pato é bom, mas bom ainda é não andar descalço')
#Out[44]: u'pe de pato e bom, mas bom ainda e nao andar descalco'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment