Python novice. I'm looping through a string, and I need to be able to index the location of each character in the string. However, .index() just gives me the first time the character pops up, and I need the location of the exact character I'm looping through.
string = "AT ST!"
for i in string[1:]:
ind = string.index(i) #only finds first instance
quote = string[ind-1] + i
print(quote)
Let's say I want this to return
AT
T
S
ST #what I want
T!
but instead it would return
AT
T
S
AT #heck
T!
Any help would be appreciated!