Just to mention that
this way you avoid having to check it's not an empty string
l
is as str
, thusif l and l[0]=='#':
is better just if l.startswith("#"):
and if l and l[-1]=='}':
is better as if l.endswith("}"):
this way you avoid having to check it's not an empty string
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