Removing a character in a string one at a time

python

Solution

Here is a quick way of doing it:

In [6]: s = "abaccea"
In [9]: [s[:key] + s[key+1:] for key,val in enumerate(s) if val == "a"]
Out[10]: ['baccea', 'abccea', 'abacce']

There is the benefit of being able to turn this into a generator by simpling replacing square brackets with round ones.

Problem

Basically I want to remove a character in a string one at a time if it occurs multiple times . For eg :- if I have a word abaccea and character 'a' then the output of the function should be baccea , abacce , abccea. I read that I can make maketrans for a and empty string but it replaces every a in the string. Is there an efficient way to do this besides noting all the positions in a list and then replacing and generating the words ??

Original source