I have string s ='edsd'
I am trying to print the combination of string using python
my expected output is below
['e', 'ed', 'eds', 'edsd', 'd', 'ds', 'dsd', 's', 'sd', 'd']
l = []
j=0
while j < len(s):
for i in range(len(s)):
l.append(s[j:i + 1])
j+= 1
My out is having blank string are coming
['e', 'ed', 'eds', 'edsd', '', 'd', 'ds', 'dsd', '', '', 's', 'sd', '', '', '', 'd']
I can try str_list = list(filter(None, l))
but my expectation is apply directly in the code, not wanted to apply again the filter after getting the output