How to detect the presence of a html file
kent at kentsjohnson.com
Fri Dec 9 20:12:11 CET 2005
> Operating System: Windows
> Python version: 2.4
> I have bookmarks.html and wumpus.c under my c:
> When I tried to check the presence of the bookmarks.html, I fail.
The problem is that \ is special in string literals. \b is a backspace
character, not the two-character sequence you expect. \w has no special
meaning so it *is* the two-character sequence you expect.
The simplest fix is to use raw strings for all your Windows path needs:
In raw strings the only \ escapes are \' and \", everything else is left
More information about the Python-list