Fredrik Lundh <[EMAIL PROTECTED]> writes:
> From what I can tell, Java's GC automatically closes file streams,
> so Jython will behave pretty much like CPython in most cases.
The finalizer does close the reclaimed streams, but since it is
triggered by GC, you have to wait for GC to occur for the
Fredrik Lundh wrote:
> Martin Marcher wrote:
>
>>> i need to read line 4 from a header file
>>
>> http://docs.python.org/lib/module-linecache.html
>
> I guess you missed the "using linecache will crash my computer due to
> memory loading, because i am working on 2000 files each is 8mb" part.
o
Steven D'Aprano wrote:
> Python guarantees[1] that files will be closed, but doesn't specify when
> they will be closed. I understand that Jython doesn't automatically close
> files until the program terminates, so even if you could rely on the ref
> counter to close the files in CPython, it wo
Russ P. wrote:
> On Jan 7, 9:41 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
>> Given that the OP is talking 2000 files to be processed, I think I'd
>> recommend explicit open() and close() calls to avoid having lots of I/O
>> structures floating around...
>>
[effectively]
>> for fid in
On Mon, 07 Jan 2008 22:16:56 -0800, Russ P. wrote:
> One second thought, I wonder if the reference counting mechanism would
> be "smart" enough to automatically close the previous file on each
> iteration of the outer loop. If so, the files don't need to be
> explicitly closed.
Python guarantees[
jo3c wrote:
> hi everybody
> im a newbie in python
> i need to read line 4 from a header file
> using linecache will crash my computer due to memory loading, because
> i am working on 2000 files each is 8mb
>
> fileinput don't load the file into memory first
> how do i use fileinput module to rea
Martin Marcher wrote:
>> i need to read line 4 from a header file
>
> http://docs.python.org/lib/module-linecache.html
I guess you missed the "using linecache will crash my computer due to
memory loading, because i am working on 2000 files each is 8mb" part.
--
http://mail.python.org/mailma
jo3c wrote:
> i need to read line 4 from a header file
http://docs.python.org/lib/module-linecache.html
~/2delete $ cat data.txt
L1
L2
L3
L4
~/2delete $ python
Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "
On Jan 8, 2:08 pm, "Russ P." <[EMAIL PROTECTED]> wrote:
> > Given that the OP is talking 2000 files to be processed, I think I'd
> > recommend explicit open() and close() calls to avoid having lots of I/O
> > structures floating around...
>
> Good point. I didn't think of that. It could als
On Jan 7, 9:41 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On Mon, 7 Jan 2008 20:10:58 -0800 (PST), "Russ P."
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
>
> > for file0 in files:
>
> > lnum = 0 # line number
>
> > for line in file(file0):
> > lnum += 1
> Given that the OP is talking 2000 files to be processed, I think I'd
> recommend explicit open() and close() calls to avoid having lots of I/O
> structures floating around...
Good point. I didn't think of that. It could also be done as follows:
for fileN in files:
lnum = 0 # line
On Jan 7, 7:15 pm, jo3c <[EMAIL PROTECTED]> wrote:
> hi everybody
> im a newbie in python
> i need to read line 4 from a header file
> using linecache will crash my computer due to memory loading, because
> i am working on 2000 files each is 8mb
>
> fileinput don't load the file into memory first
>
hi everybody
im a newbie in python
i need to read line 4 from a header file
using linecache will crash my computer due to memory loading, because
i am working on 2000 files each is 8mb
fileinput don't load the file into memory first
how do i use fileinput module to read a specific line from a file
13 matches
Mail list logo