7
I'm trying to combine similar characters that are next to each other that are in a list. I was wondering if there was a Python way to do it? Here's an example: test = 'hello###_world###test#test123##' splitter = re.split("(#)", test) splitter = filter(None, splitter) Which returns this in the splitter variable: ['hello', '#', '#', '#', '_world', '#', '#', '#', 'test', '#', 'test123', '#', '#'] I'm trying to combine the hashes so the list turns into this: ['hello', '###', '_world', '###', 'test', '#', 'test123', '##'] Thanks for any help!
python
...