I am new to Python and am still learning. If I have a string that contains several possible characters within []
, how do I create and output that spits out all possible values? For example, let's say my string is "ABC[XY]123"
, where the possible outputs are either "ABCX123"
or "ABCY123"
. I want to create a script that prints both of those possibilities from the original input of "ABC[XY]123"
. I am aware of the fact that this is not a list, but a string. Does it make sense to turn the string in to a list first as well? Any help would be appreciated. Thank you.