(Jan-03-2021, 04:05 PM)AntaresSky Wrote: I take it the Line.Lstrip is telling it to removed the whole line?str.lstrip() will remove whitespace on the left end of the string, i.e. leading whitespace at the start of the string
str.rstrip() will remove whitespaces on the right end of the string, i.e. trailing whitespace at the end.
str.strip() will remove whitespace on bith ends.
Your best friend is the documentation. If in doubt - check the docs.
so the original
line.lstrip()
will remove any white space at the start of the line, so that if present the first non-whitespace char will be ; in comments. But it will not remove the new-line char \n
at the end.Also, note that python is case sensitive
Line.Lstrip()
is not same as line.lstrip()
and will cause error.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs