Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def name_to_ascii(antigo):
- vogais = {'a': range(224, 230), 'e': range(232, 235), 'i': range(236, 239) \
- , 'o': range(242, 246) + [240, 248], 'u': range(249, 252), 'c': 231}
- tmp = []
- for ch in antigo:
- if not is_ascii(ch):
- if ord(ch) in vogais['a']:
- tmp.append('a')
- elif ord(ch) in vogais['e']:
- tmp.append('e')
- elif ord(ch) in vogais['i']:
- tmp.append('i')
- elif ord(ch) in vogais['o']:
- tmp.append('o')
- elif ord(ch) in vogais['u']:
- tmp.append('u')
- elif ord(ch) == vogais['c']:
- tmp.append('c')
- else:
- print antigo
- print 'Erro: {0} ({1})'.format(ch, ord(ch))
- exit(1)
- else:
- tmp.append(ch)
- novo = ''.join(tmp)
- print 'Antigo: {0}'.format(antigo)
- print 'Novo: {0}'.format(novo)
- print '-'
Add Comment
Please, Sign In to add comment