+ 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' , '' , ',')

15th Dec 2017, 6:19 PM
Shikha S
2 Respostas
+ 3
mylist = list(filter(lambda x: x in [......], list(line)))
15th Dec 2017, 8:38 PM
Oma Falk
Oma Falk - avatar
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')
17th Dec 2017, 7:43 AM
Shikha S