I don't know if my title is correct or it makes sense but that's the only thing that I think of since the split() method turns/splits string inputs into list.
This is my code
import re
fruits = "apple,orange,mango*banana"
listOfFruits = re.split("[,*]",fruits)
storage = ""
for i in range(0, len(listOfFruits)):
storage = storage + ("({}) \n({})\n".format(listOfFruits[i], listOfFruits[i]))
finalStorage = storage + "\n"
print(finalStorage)
And the output looks like this
(apple)
(apple)
(orange)
(orange)
(mango)
(mango)
(banana)
(banana)
What I want is that whenever the code sees an asterisk(*), it will automatically indent itself inside of what words was before it
What I would like my output
(apple)
(apple)
(orange)
(orange)
(mango)
(banana)
(banana)
(mango)
Other example
fruits = "mango+banana+grapes,orange+apple
The expected output should look like this
(mango)
(banana)
(grapes)
(grapes)
(banana)
(mango)
(orange)
(apple)
(apple)
(orange)