![]() Like this: from json import dumpsįor x in range(length): # xrange in Python 2.7įpg = fake_person_generator(length, fake) To save the order of items you should explicitly preserve the index of an each element. Even if order will be saved in the file - it will breaks when another project will parse that file. You do not need to use OrderedDict: JSON format may not (and will not) save order of items. I've tried list comprehension, map(), the results were the same as for loop. Download card details in three formats: JSON, XML & CSV. While trying to fix this issue, I'm still looking a way to squeeze the generation time even more. Features Generate thousands of fake / dummy credit card numbers & details using our free bulk generator tool. The problem is when I try to go further, for example, 2 millions data, which I would expect it to finish in ~1200 seconds, the script runs beyond this time and I'm greeted by this exception MemoryError with no explanation on why it occurred, I believe it has something to with PYPY_GC_MAX, but again a 2M file should weight ~440mb. I'm currently able to generate a json file with 1 million data, which is about 220mb, in ~600 seconds. I tried PyPy, and I was blown away by the results. With open('%s.json' % filename, 'w') as output: ('street_address', fake.street_address()), I'm currently using the Faker package in the code below: from json import dumpsĭatabase.append(collections.OrderedDict([ Most of them provide only one or two services.I need some dummy data in json format, to use in another project. How Randommer is different from other services? Most of the alternatives don't offer API support or it offers only a low daily quota for free. ![]() Random Data API is more than your API generator.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |