I've got a series of arrays that I want to use, but they're not formatted correctly for JavaScript. I'm trying to use Python to edit them, since that's what I'm familiar with, and it's not working quite right. My array looks like this:
text = """[["a", "b", "c"]["d, "e", "f"]]"""
text = list(text)
counter = 0
for letter in text:
if letter == "]":
text.insert(counter, ",")
counter += 1
print (''.join(text))
I am trying to make it so that I get a list of all the characters in text, then my for loop goes through and adds a comma after all the ']'s. The join statement should put the list back into a string again.
My code works fine when I take out the for loop, but it doesn't work at all when I add it. I can't see what I'm doing wrong, any ideas?
"after thedintentionally?