I have this script
for line in file: while line[i] == " ": if i == len(line): break i += 1 if i == len(line): pass while not line[i] == " ": if i == len(line): break obj += line[i] i += 1 print obj
As of now,
["clear", "exit"] and
When I run this script, it errors like this
Traceback (most recent call last): File "/home/ubuntu/workspace/lib/source.py", line 8, in <module> while not line[i] == " ": IndexError: string index out of range
I'm pretty sure my loop is protected right, and it should break before this happens. If this the case, then why is it happening?