KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In Python, I'd like to split a string using a list of separators. The separators could be either commas or semicolons. Whitespace should be removed unless it is in the middle of non-whitespace, non-separator characters, in which case it should be preserved. Test case 1: ABC,DEF123,GHI_JKL,MN OP Test case 2: ABC;DEF123;GHI_JKL;MN OP Test case 3: ABC ; DEF123,GHI_JKL ; MN OP Sounds like a case for regular expressions, which is fine, but if it's easier or cleaner to do it another way that would be even better. Thanks!
Tags (comma-separated)
Save Edits
Cancel