Splitting a string using regular expressions

suggest change

You can also use regular expressions to split a string. For example,

import re
data = re.split(r'\s+', 'James 94 Samantha 417 Scarlett 74')
print( data )
# Output: ['James', '94', 'Samantha', '417', 'Scarlett', '74']

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents