How to delete a character from a string using Python

前端 未结 16 1544
耶瑟儿~
耶瑟儿~ 2020-11-22 16:35

There is a string, for example. EXAMPLE.

How can I remove the middle character, i.e., M from it? I don\'t need the code. I want to know:

16条回答
  •  一向
    一向 (楼主)
    2020-11-22 17:20

    Another way is with a function,

    Below is a way to remove all vowels from a string, just by calling the function

    def disemvowel(s):
        return s.translate(None, "aeiouAEIOU")
    

提交回复
热议问题