Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #90953

Re: Best approach to create humongous amount of files

References <CAPkZ3MS5SiGH9OCe9RSTmakF681O+qM572y49FuDBmBix=aiFg@mail.gmail.com>
Date 2015-05-20 22:58 +1000
Subject Re: Best approach to create humongous amount of files
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.168.1432126695.17265.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, May 20, 2015 at 9:44 PM, Parul Mogra <scoria.799@gmail.com> wrote:
> My objective is to create large amount of data files (say a million *.json
> files), using a pre-existing template file (*.json). Each file would have a
> unique name, possibly by incorporating time stamp information. The files
> have to be generated in a folder specified.
>
> What is the best strategy to achieve this task, so that the files will be
> generated in the shortest possible time? Say within an hour.

If they're to be created within an hour, timestamp of creation
probably isn't useful, but if you have internal data to use as the
file name, that would work. Otherwise, try a simple sequential
integer.

All you'd need would be a loop that creates a bunch of files... most
of your code will be figuring out what parts of the template need to
change. Not too difficult.

ChrisA

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: Best approach to create humongous amount of files Chris Angelico <rosuav@gmail.com> - 2015-05-20 22:58 +1000
  Re: Best approach to create humongous amount of files paul.anton.letnes@gmail.com - 2015-05-20 08:32 -0700

csiph-web