OneCompiler

How to Print alphabets in a string in Python?

If we have a string like a32b7

I want to print the output as

a
b

How can I do so using Python?

1 Answer

5 years ago by

You can use isalpha()

s = "a32b7"
for i in s:
   if i.isalpha() :
      print(i)

Check output here

5 years ago by Divya