Re: Newbie Text Processing Question

2005-10-04 Thread Fredrik Lundh
Gregory Piñero wrote: >That's how Python works. You read in the whole file, edit it, and write it > back out. that's how file systems work. if file systems generally supported insert operations, Python would of course support that feature. -- http://mail.python.org/mailman/listinfo/python-

Re: Newbie Text Processing Question

2005-10-04 Thread Mike Meyer
[EMAIL PROTECTED] writes: > I'm a total newbie to Python so any and all advice is greatly > appreciated. Well, I've got some for you. > I'm trying to use regular expressions to process text in an SGML file > but only in one section. This is generally a bad idea. SGML family languages aren't easy

Re: Newbie Text Processing Question

2005-10-04 Thread James Stroud
You can edit a file in place, but it is not applicable to what you are doing. As soon as you insert the first "", you've shifted everything downstream by those 8 bytes. Since they map to a physically located blocks on a physical drive, you will have to rewrite those blocks. If it is a big file

Re: Newbie Text Processing Question

2005-10-04 Thread Gregory Piñero
That's how Python works.  You read in the whole file, edit it, and write it back out.  As far as I know there's no way to edit a file "in place" which I'm assuming is what you're asking? And now, cue the responses telling you to use a fancy parser (XML?) for your project ;-) -Greg On 4 Oct 2005 2