Answers for "re.split return none in the list"

0

re.split return none in the list

# example of expression giving none
re.split(r'(\+)|(\-)|(\*)', text)

# you are getting null because it matches all the groups
# every time it finds a match.
# so just remove the paranthsis after this |
# correct for not getting null

re.split(r'\+|\-|\8', text)
Posted by: Guest on June-13-2021

Browse Popular Code Answers by Language