Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to remove vowels from a string in python

string = input("Enter any string: ")
if string == 'x':
    exit();
else:
    newstr = string;
    print("
Removing vowels from the given string");
    vowels = ('a', 'e', 'i', 'o', 'u');
    for x in string.lower():
        if x in vowels:
            newstr = newstr.replace(x,"");
    print("New string after successfully removed all the vowels:");
    print(newstr);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #vowels #string #python
ADD COMMENT
Topic
Name
5+5 =