programming-examples/python/Regular_Expression/Separate and print the numbers of a given string.py
2019-11-15 12:59:38 +01:00

7 lines
172 B
Python

import re
# Sample string.
text = "Ten 10, Twenty 20, Thirty 30"
result = re.split("\D+", text)
# Print results.
for element in result:
print(element)