get-a-cup-of-coffee slow

Russell E. Owen owen at astroNOJNK.washington.edu.invalid
Fri Aug 10 23:36:41 EDT 2001


In article <9kurh302g4k at drn.newsguy.com>, Grant Griffin 
<not.this at seebelow.org> wrote:

>...
>Also, I tried writing something like this with a list (which are 
>presumably more
>suited to being appended), but then I realized that I didn't know how to 
>write
>the contents of a list to a file as a stream of bytes.  There's probably a
>simple way to do that: what is it?

Both the array and NumPy modules allow data to be written to (or read 
from) a file, string or list (except I'm not positive about lists in 
NumPy).

So...I would try using an array to start with. But,if you find a list is 
faster (which I'd find a bit surprising because lists are less space 
efficient, but space is not speed) you could then generate an array from 
it and write it out to your file from the array.

-- Russell



More information about the Python-list mailing list