On Sat, Jul 17, 2010 at 11:06, Alan Gauld <alan.ga...@btinternet.com> wrote: > > "Richard D. Moores" <rdmoo...@gmail.com> wrote > >> amount of memory my laptop has (4 GB). So my question is, how can I do >> this differently? I'm pretty brand new to opening and writing files. >> Here, I can't write many shorter lines, because the end result I seek >> is one long string. But am I correct? > > Others have answered that but I will ask, have you considered what > you will do with this 4G string once you have created it?
Windows Explorer tells me it is 976,563 KB. > You will not > be able to read it back into your memory in one piece so you will > need to process it in chunks. Yes, that's true. Here's what I'm doing with a 200-million-digit string: <http://tutoree7.pastebin.com/rJ1naffZ>. But this script with a 500 million string already causes a memory problem, and 1 billion is impossible. If I processed in chunks, they would need to overlap slightly, because the sequences to be found, such as 05251896 (my father's birth date) could overlap the boundary between 2 neighboring chunks, and thus not be located. That's about as far as I've got in thinking about the problem. > It may be as well considering what you intend to do with it before > creating it? There may be a better representation. Now that you see what I want to do with 1 billion random digits, please give me your suggestion(s). As I mentioned before, I'm very new to reading from and writing to files. I think the project is much more interesting/satisfying, though technically almost identical, when locating sequences of digits in pi. I have a 100-million-digit file for this (thanks to gmpy.pi()), but haven't tried for anything bigger. Here's the script that handles searches in the mantissa of pi: <http://tutoree7.pastebin.com/3mqCNgQJ>. I've put the 1 million digits of pi on my website in the Pi directory at <http://www.rcblue.com/Pi/> should anyone want to try this out. I'm not sure what my downloading limit is, so I may not leave the file up there more than 24 hours. Dick _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor