fork download
  1. text = "West Team 4, Eastern 3\n"
  2. print( ["".join(c for c in x if c.isalpha() or c.isspace()).strip() for x in text.split(',')] )
  3.  
  4. import re
  5. rx = re.compile(r'[^a-zA-Z\s]+')
  6. print( [rx.sub("", x).strip() for x in text.split(',')] )
  7.  
  8. print(re.findall(r',?\s*(\D*[^\d\s])', text))
Success #stdin #stdout 0.03s 9524KB
stdin
Standard input is empty
stdout
['West Team', 'Eastern']
['West Team', 'Eastern']
['West Team', 'Eastern']