Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
beginner help in python
#6
(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 updating start, but your inner while doesn't change the comparison.

I suspect you intended the inner while to instead be if line[start].isspace() == False:

But the split() 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?
Reply


Messages In This Thread
beginner help in python - by aghapouria - Dec-12-2020, 11:18 PM
RE: beginner help in python - by Larz60+ - Dec-13-2020, 02:03 AM
RE: beginner help in python - by bowlofred - Dec-13-2020, 07:08 AM
RE: beginner help in python - by aghapouria - Dec-13-2020, 03:26 PM
RE: beginner help in python - by ndc85430 - Dec-13-2020, 07:22 AM
RE: beginner help in python - by aghapouria - Dec-13-2020, 03:22 PM
RE: beginner help in python - by bowlofred - Dec-13-2020, 04:57 PM
RE: beginner help in python - by aghapouria - Dec-13-2020, 09:11 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020