[Tutor] html checker
bgailer at gmail.com
Mon Oct 1 20:48:39 CEST 2012
On 10/1/2012 11:45 AM, Matthew Dalrymple wrote:
> Im trying to write an html syntax checker...pretty much read an
> imported file, if it has all the opening and closing "<" and ">" it
> will return True and if it doesn't it will return False.
> this is what i have so far
> how can i get it to run correctly?
Welcome to the tutor list. I assume this is your first visit. Why?
because we always request that you tell us what happens to lead you to
say it does not run correctly. This can mean many things.
So - what happens when you run the program? Be specific.
Also - always reply-all so a copy goes to the list.
Tell us which version of Python you are using, which OS and what you do
to run the program.
Put your response(s) after the item(s) you are responding to (as I have
done here). In other words do not "top-post".
Delete irrelevant text (as I have done here).
A quick glance at your program shows many flaws.
from pythondsBasicimport stack
This is an unknown (to me and to Google) module. Where did you get it?
What is stack?
for linein infile:
This will read all the lines in the file. Each line in turn will be
assigned to data,
so at the of the loop data will contain the last line. data is not
else in the program.
for chin infile:
Will immediately terminate as the file is now at EOF. If you were to
remove the for line in infile: loop then ch will contain one line, not
Your program does an import and defines functions. There is nothing in
it to run any of the functions.
There are many other problems! Too many for me to continue analyzing and
Did you succeed in the previous labs? How did you get this far and then
fail so miserably?
Chapel Hill NC
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor