How do you separate numbers and letters in a string?

 A series of letters and numbers. How to split a string into subsets of letters or numbers based on the boundary between letters and numbers and vice versa.

Method: The re.split(pattern, string) strategy coordinates with all events of the example in the string and partitions the string along the matches bringing about a rundown of strings between the matches.

  1. import re 
  2. s = '111A222B333C' 
  3. res = re.split('(\d+)', s) 
  4. print(res) 

This code is done in pythonThere are various methods to separate numbers and letters in a string. just search in the google search box and you can see various result on the SERP(search engine result page)

Comments