str remove except alphabets

Solutions on MaxInterview for str remove except alphabets by the best coders in the world

showing results for - "str remove except alphabets"
Renata
20 Jan 2019
1#take user input
2String1 = input('Enter the String :')
3#initialize empty String
4String2 = ''
5for i in String1:
6    #check for alphabets
7    if (ord(i) >= 65 and ord(i) <= 90) or (ord(i) >= 97 and ord(i) <= 122):
8        #concatenate to empty string
9        String2+=i
10print('Alphabets in string are :' + String2)