小编Anu*_*del的帖子

从字符串python中删除元音

我期待下面的代码中的元音免费字符串,但它没有给我我期待的东西.请帮忙.

def disemvowel(word):
    words = list(word)
    for i in words:
        if i.upper() == "A" or i.upper() == "E" or i.upper() == "I" or i.upper() == "O" or i.upper() == "U":
            words.remove(i)


    return print(''.join(words))

disemvowel("uURII")
Run Code Online (Sandbox Code Playgroud)

我期待输出为'R',但我得到'URI'.

python python-3.x

0
推荐指数
1
解决办法
1242
查看次数

标签 统计

python ×1

python-3.x ×1