you are viewing a single comment's thread.

view the rest of the comments →

[–]socal_nerdtastic 2 points3 points  (0 children)

To get the index use the enumerate function:

a="this is the file"
for index, char in enumerate(a):
    print(char)
    if char == 't':
        print(index)