How to split the string if special character in string and keep the string in same python?
For Example:
Input:
asdf****adec****awd**wer*
Needed Output:
['asdf','****','adec','****','awd','**','wer','*']
My code:
import re
a=input().strip()
s=re.findall('[*]|\w+', a)
print(s)
My output:
['asdf', '*', '*', '*', '*', 'adec', '*', '*', '*', '*', 'awd', '*', '*', 'wer', '*']
What mistake i made?? my special characters are printind seperately .
Is there any method without using modules??