Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to split a string between letters and digits python

import re
s='abcd2343 abw34324 abc3243-23A'

re.split('(d+)',s)
> ['abcd', '2343', ' abw', '34324', ' abc', '3243', '-', '23', 'A']

# Or, if you want to split on the first occurrence of a digit:
re.findall('d*D+',s)
> ['abcd', '2343 abw', '34324 abc', '3243-', '23A']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #split #string #letters #digits #python
ADD COMMENT
Topic
Name
9+5 =