Search
 
SCRIPT & CODE EXAMPLE
 

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']
Comment

PREVIOUS NEXT
Code Example
Python :: python check file format 
Python :: read file line by line into list 
Python :: STandardScaler use example 
Python :: clear console python 
Python :: image to text python 
Python :: python how to get number of strings in a list 
Python :: python system year 
Python :: python remove empty string from list 
Python :: how to get pc name with python 
Python :: python copy file 
Python :: how to create dynamic variable names in python 
Python :: Find the Runner Up Score solution in python3 
Python :: save image requests python 
Python :: print upto 1 decimal place python 
Python :: visualize correlation matrix python 
Python :: .fill pygame 
Python :: check if any value is null in pandas dataframe 
Python :: discord.py status 
Python :: random word generator python 
Python :: membercount discord.py 
Python :: convert numpy array to dataframe 
Python :: get local timezone python 
Python :: python open script in new terminal 
Python :: set os environment variable python 
Python :: pandas datetime show only date 
Python :: display max rows pandas 
Python :: superscript print python 
Python :: chrome driver download for selenium python 
Python :: remove negative numbers from list python 
Python :: python find most occuring element 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =