python how to uppercase some characters in string

前端 未结 9 1394
北荒
北荒 2021-01-21 17:51

Here is what I want to do but doesn\'t work:

mystring = \"hello world\"
toUpper = [\'a\', \'e\', \'i\', \'o\', \'u\', \'y\']
array = list(mystring)

for c in arr         


        
9条回答
  •  无人及你
    2021-01-21 18:30

    Easy method

    name='india is my country and indians are my brothers and sisters'
    vowles='a','e','i','o','u'
    for name_1 in name:
        if name_1 in vowles:
            b=name_1.upper()
            print(b,end='')
        else:
            print(name_1,end='')
    

提交回复
热议问题