I need help on some python for loops
How would I go about making it so in a
for i in str: it will check if i is a ">" then check if the next character is a " ". If its true then continue the for loop, if its not true insert a " ".
For this you need to create a list to check.
strng = "Go here> " list_ =  for i in strng: list_.append(i) if ">" in list_: index_of_symbol = list_.index(">") try: if list_[index_of_symbol+1] == " ": print('There is a " " after the symbol ">".') else: print('No " " after symbol ">".') except: print('No " " after symbol ">".')
you can go index by index, sort of like this:
string = "> " for i in range(len(string)): if string[i] == ">" and (i + 1 < len(string) and string[i + 1] != ' '): # do your inserting
by the way
you should never name your variables
str, it's already a function class!