I have a string that I inserted a space into it in all different positions and saved them to a list. Now this list of strings with space in them, I want to split those strings and put the output in one list, when am doing this, it happens that am having multiple list inside:
This is the code am working on:
var ='sans'
res = [var[:i]+' '+var[i:] for i in range(len(var))]
// The previous line: AM adding a space to see maybe that would generate other words
cor = [res[i].split() for i in range (len(res))]
And this is the output am getting:
>>> cor
[['sans'], ['s', 'ans'], ['sa', 'ns'], ['san', 's']]
What am expecting:
>>> cor
['sans', 's', 'ans', 'sa', 'ns', 'san', 's']
Am new to python, I don't know what am missing.
Thanks