
- Python 3 Basic Tutorial
- Python 3 - Home
- What is New in Python 3
- Python 3 - Overview
- Python 3 - Environment Setup
- Python 3 - Basic Syntax
- Python 3 - Variable Types
- Python 3 - Basic Operators
- Python 3 - Decision Making
- Python 3 - Loops
- Python 3 - Numbers
- Python 3 - Strings
- Python 3 - Lists
- Python 3 - Tuples
- Python 3 - Dictionary
- Python 3 - Date & Time
- Python 3 - Functions
- Python 3 - Modules
- Python 3 - Files I/O
- Python 3 - Exceptions
Remove Vowels from a String in Python
Suppose we have a string, we have to remove all vowels from that string. So if the string is like “iloveprogramming”, then after removing vowels, the result will be − "lvprgrmmng"
To solve this, we will follow these steps −
- create one array vowel, that is holding [a,e,i,o,u]
- for v in a vowel
- replace v using blank string
Example
Let us see the following implementation to get a better understanding −
class Solution(object): def removeVowels(self, s): s = s.replace("a","") s = s.replace("e","") s = s.replace("i","") s = s.replace("o","") s = s.replace("u","") return s ob1 = Solution() print(ob1.removeVowels("iloveprogramming"))
Input
"iloveprogramming"
Output
lvprgrmmng
- Related Articles
- Remove vowels from a String in C++
- How to remove all vowels from textview string in Android?
- How to remove vowels from a string using regular expressions in Java?
- Reverse Vowels of a String in Python
- First X vowels from a string in C++
- Count and display vowels in a string in Python
- How to Remove Punctuations From a String in Python?
- Remove all duplicates from a given string in Python
- How to remove specific characters from a string in Python?
- Python Pandas – Remove numbers from string in a DataFrame column
- Program to remove duplicate characters from a given string in Python
- Reversing vowels in a string JavaScript
- Return Vowels in a string in JavaScript
- Remove comma from a string in PHP?
- Reverse Vowels of a string in C++

Advertisements