20050126 find replace strings in file
danperl at rogers.com
Wed Jan 26 17:50:59 EST 2005
<takarov2003 at yahoo.com> wrote in message
news:1106776836.679242.167880 at c13g2000cwb.googlegroups.com...
> I guess there is no way to check if the file opened fine? What if the
> filesystem or file is locked for this user/session. Pretty puny
> language if it cannot tell you that it cannot do what you tell it to.
> Same for the close. Is there no way check a good close?
An exception (IOError) is raised when a file operation fails. The open()
and and close() statements should be enclosed in a try-except statement.
Please, take Xah Lee's postings with more than just a grain of salt. As a
matter of fact, you are better off ignoring them than trying to learn from
them. He is an egomaniac who is learning python and who thinks that he can
already teach others. Personally I doubt he will ever learn python well
enough to teach others. Just look at his English. He has a similar list
with a-word-a-day just like the perl-python a-lesson-a-day and he seems
indeed to know a lot of words. But his grammar is horrendous (there's a
word for you, Xah Lee!). And according to his own website he's been living
in North America for more than 15 years! English is a second language for
me too but you won't see me writing something like "this groups is for
Perlers who wants to learn Python".
It may be unfair to pick on his English, but it is the best way I can make
the point to someone who does not know python that Xah Lee does not know
what he's talking about. I find Xah Lee annoying and I could just ignore
him, but I am concerned that some people may actually take his statements
seriously and learn from them. I can't imagine why or how, but there are
actually 26 members in the perl-python Yahoo! group who have registered to
get these bogus lessons sent to them daily!
More information about the Python-list