54 lines
2.1 KiB
Plaintext
54 lines
2.1 KiB
Plaintext
From: wlfraed at ix.netcom.com (Dennis Lee Bieber)
|
|
Date: Fri, 30 Apr 1999 05:37:51 GMT
|
|
Subject: HTML "sanitizer" in Python
|
|
References: <s7284e9b.080@holnam.com>
|
|
Message-ID: <37293e7c.2958315@nntp.ix.netcom.com>
|
|
Content-Length: 1900
|
|
X-UID: 1209
|
|
|
|
On Thu, 29 Apr 1999 12:20:27 -0400, "Scott Stirling"
|
|
<SSTirlin at holnam.com> declaimed the following in comp.lang.python:
|
|
|
|
> On opening files in Windows--I was hoping there was a way to give python the full file path. Everything I have seen so far just tells me how to open a file if it's in the same directory I am running python from.
|
|
>
|
|
> I don't have sed on my MS Windows PC at work. This was part of the initial explanation--I am working for a company where we have DOS, Windows and Office 97. No sed, no Unix. This is a Y2K Project too, so we are on a budget with little leeway for new ideas that weren't included in the original statement of work and project plan.
|
|
>
|
|
Did you try?
|
|
|
|
Actually, you might have gotten caught on the \ treatment.
|
|
|
|
> PythonWin 1.5 (#0, Dec 30 1997, 23:24:20) [MSC 32 bit (Intel)] on win32
|
|
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
|
|
> Portions copyright 1994-1998 Mark Hammond (MHammond at skippinet.com.au)
|
|
> >>> fo = open("h:\temp\somefile.txt","w")
|
|
> Traceback (innermost last):
|
|
> File "<interactive input>", line 1, in ?
|
|
> IOError: (2, 'No such file or directory')
|
|
> >>> fo = open("h:/temp/somefile.txt", "w")
|
|
> >>> fo.write("This is a line of text\n")
|
|
> >>> fo.close()
|
|
> >>>
|
|
> >>> fo=open("h:\\temp\\somefile.txt","r")
|
|
> >>> for ln in fo.readlines():
|
|
> ... print ln
|
|
> ...
|
|
> This is a line of text
|
|
>
|
|
> >>> fo.close()
|
|
> >>>
|
|
|
|
Note the use of reversed / on the first open, and the doubled \\
|
|
on the second.
|
|
|
|
--
|
|
> ============================================================== <
|
|
> wlfraed at ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
|
|
> wulfraed at dm.net | Bestiaria Support Staff <
|
|
> ============================================================== <
|
|
> Bestiaria Home Page: http://www.beastie.dm.net/ <
|
|
> Home Page: http://www.dm.net/~wulfraed/ <
|
|
|
|
|
|
|
|
|