I want to extract Name and number from a given string and save it into two lists.
str = 'Dhoni scored 100 runs and Kohli scored 150 runs.Rohit scored 50 runs and Dhawan scored 250 runs .'
I want to acheive :
name = ['Dhoni','Kohli','Rohit','Dhawan']
values = ['100','150','50','250']
I tried to use negative-look ahead but did not succeed. I am trying to use the approach as match a word then a number then again a word. May be I am wrong in this approach. How this can be acheived?
What I tried :
pattern = r'^[A-Za-z]+\s(?!)[a-z]'
print(re.findall(pattern,str))