#! /usr/bin/env python3 import string UGGLY_CHARACTERS = {'č': 'c', 'ṣ': 's', 'œ': 'oe', 'Ÿ': 'Y', 'ş': 's', 'á': 'a', 'à': 'a', 'ã': 'a', 'â': 'a', 'å': 'a', 'ä': 'a', 'ç': 'c', 'æ': 'ae', 'é': 'e', 'è': 'e', 'ë': 'e', 'ê': 'e', 'í': 'i', 'ì': 'i', 'ï': 'i', 'î': 'i', 'ñ': 'n', 'ð': 'd', 'ó': 'o', 'ò': 'o', 'õ': 'o', 'ô': 'o', 'ö': 'o', 'ù': 'u', 'ø': 'o', 'û': 'u', 'ú': 'u', 'ü': 'u', 'ÿ': 'y'} def clean(text): newText = '' for oneChar in text.lower(): if oneChar in UGGLY_CHARACTERS: newText += UGGLY_CHARACTERS[oneChar] else: newText += oneChar return newText test = "Il était une fois un maçon, ma fois un peu con..." print(test, clean(test), sep='\n')