“Python Faker Json” Kod odpowiedzi

Python Faker Json

from json import dumps
from faker import Faker
import collections

database = []
filename = '1M'
length   = 1000000
fake     = Faker() # <--- Forgot this

for x in range(length):
    database.append(collections.OrderedDict([
        ('last_name', fake.last_name()),
        ('first_name', fake.first_name()),
        ('street_address', fake.street_address()),
        ('email', fake.email())
    ]))

with open('%s.json' % filename, 'w') as output:
    output.write(dumps(database, indent=4))
print "Done."
Stupid Shrike

Python Faker Json

from json import dumps
from faker import Faker
import collections

database = []
filename = '1M'
length   = 1000000
fake     = Faker() # <--- Forgot this

for x in range(length):
    database.append(collections.OrderedDict([
        ('last_name', fake.last_name()),
        ('first_name', fake.first_name()),
        ('street_address', fake.street_address()),
        ('email', fake.email())
    ]))

with open('%s.json' % filename, 'w') as output:
    output.write(dumps(database, indent=4))
print "Done."
Stupid Shrike

Odpowiedzi podobne do “Python Faker Json”

Pytania podobne do “Python Faker Json”

Więcej pokrewnych odpowiedzi na “Python Faker Json” w JavaScript

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu