Python Regex Split

July 3, 2019
import re

value = "item 01, item 02 ,item 03 , item 04"

p = re.compile(r'\s*,\s*')
items = p.split(value)

or

items = re.split(r'\s*,\s*', value)
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.