Exemple Supprimez les voyelles "a, e, i, o, u" de "J'apprends Python." Et affichez "je suis lrnng Pyth n.".
Certaines lettres sont des voyelles = ['a', 'e', 'i', 'o', 'u', 'A', 'I', 'U', 'E', 'O' ] Certaines chaînes sont "J'apprends Python."
example.py
def anti_vowel(text):
    vowels = ['a','e','i','o','u','A','I','U','E','O']
    new_text =[]
    for i in text:
        new_text.append(i)
        for j in vowels:
            if i == j:
                new_text.remove(j)
    return ''.join(new_text)
print anti_vowel('I am learning Python.')
# m lrnng Pythn.
C'est également le cas.
example2.py
def anti_vowel(text):
        new_text = ""
        vowels = "aeiouAEIOU"
        for i in text:
            if i not in vowels:
                new_text += i
        return new_text
print anti_vowel('I am learning Python.')
Si vous écrivez sur une seule ligne
example3.py
def anti_vowel(text):
    return ''.join([new_text for new_text in list(text) if new_text not in 'aeiouAEIOU'])
print anti_vowel('I am learning Python.')
En utilisant des expressions régulières (* mémo: étude requise), vous pouvez écrire comme suit.
example.py
import re
s='I am learning Python.'
print re.sub('[aeiouAEIOU]', '', s)
#Or
print s.translate(None, 'aeiouAEIOU')
#Or
print filter(lambda c: c.lower() not in 'aeiou', s)
Merci @knoguchi!