Dec-13-2020, 03:26 PM
(Dec-13-2020, 07:08 AM)bowlofred Wrote: And for your original code:
* You're comparing line.isspace, not line.isspace()
* line.isspace() is only true if the entire line is spaces.
* You're updatingstart
, but your inner while doesn't change the comparison.
I suspect you intended the inner while to instead beif line[start].isspace() == False:
But thesplit()
version is better.
You are absolutely right, i forgot the [start]-part and now it is working. However now i get a "string index out of range error", any idea why?