[Tutor] Question on a example in the book "Learn to program usingpython" by Alan Gauld

Alan Gauld alan.gauld at blueyonder.co.uk
Mon Aug 2 22:05:52 CEST 2004


> Shouldnt there be a "...D = TextDocument(sys.argv[1])... " somewere?

Only if you pass it .txt files.
An interesting excercise would be to strip off the last bit of
the filename and see if it matches '.txt' or '.htm' or '.html'
and create the appropriate type of document object.

Hint: There is a module for manipulating filenames :-)

> OT...and Alan you should not be sorry for the small errors in your
book,
> its the best "computer book" i have ever read

Aw shucks! :-)

As to your problem, I can't see anything significantly different to
my original code (as per the CD ROM with the book and written prior
to the reviewers and copy-editors and typesetters "improvements"!)
which definitely works...

I'll try to get back to it later tonight.
Meantime, what kind of file are you passing as a parameter?
And are you actually using TextDocument or HTMLDocument?

Regards,

Alan G.



More information about the Tutor mailing list