怎样用python编程,把一个字符串中某个特定字符大写。

比如说要大写语句中每个元音字母:
例如:输入“hello world”
我想让它输出“hEllO wOrld"
怎么弄???

第1个回答  2011-11-06
owel = ['a','e','i','o','u']
s = 'hello world'
for i in s:
if i in owel:
s2 = s2 + i.capitalize()
else:
s2 = s2 +i
print(s2)本回答被提问者采纳
第2个回答  2011-11-10
str = 'haelilouuuuuu'
list_vowel = 'a,e,i,o,u'
list = []
for word in str:
if word in list_vowel:
word.upper()
list.append(word)
print(''.join(list))
第3个回答  2011-11-06
import string
'hello world'.translate(string.maketrans('aeiou', 'AEIOU'))