How to insert only the capital letters from words in a string into a list in Python

1 Answer

0 votes
import re 
   
s = 'PythonJavaPascalCobol'

lst = re.findall('([A-Z])', s)

print(lst)
    
    
    
'''
run:
    
['P', 'J', 'P', 'C']
    
'''

 



answered Jan 14, 2020 by avibootz

Related questions

...