+ 1
split line into words using all special characters as delimiter but to keep delimiter in list.
split line into words using all special characters as delimiter but to keep delimiter in list. e.g. - line -> A.B C;D , o/p -> list=('A' , '.' , 'B' , '' , 'C' , ';' , 'D' , '' , ',')
2 ответов
+ 3
mylist = list(filter(lambda x: x in [......], list(line)))
0
Thanka Oma for your response .But, this will split each character. If i have multiple alphanumeric between two delimiter, i want them as single string.
e.g. - line -> Aba.bx cd;e2f
o/p -> list=('Aba' , '.' , 'bx' , ' ' , 'cd' , ';' ,'e2f')