Okay, so my original problem was adding characters to a specific element in a list, but then I encountered the problem of my fix overwriting my entire list, leaving me with the edited element.
listy = ['item_1','item_2','item_3'] listy = ['('+listy+')'] print(listy) >'(item_2)'
I understand why this is happening, I just don’t know how to also add back the rest of the list (non-manually)
I tried doing:
listy = [listy[0:1] + '('+listy+')' + listy[2:]]
And got back a
TypeError, which I expected, but wanted to make sure it didn’t work first.
This was all I tried.
Assign to the list index, not the variable holding the entire list.
listy = '('+listy+')'