is there a way to do it like this ? since i want EVERY vowels to be replaced by '-'
list1 = ['john', 'tony', 'luck', 'o'] def replace_vowel(mlist): vowels = 'aeiouAEIOU' newlist = [c.replace(vowels, '-') for c in mlist] return newlist print replace_vowel(list1)
Output:['john', 'tony', 'luck', '-']
or with:newlist = ['-' if c in 'aeiou' else c for c in mlist] return newlistsame output