def generate_dataset_shelve(filename, number_items=1000):
 if os.path.exists(filename):
  os.remove(filename)
 data = shelve.open(filename)
 names = get_names()
 totalnames = len(names)
 random.seed()
 for i in range(number_items):
  data[str((i + 1))] = {'name': names[random.randint(0, (totalnames - 1))], 'age': random.randint(1, 100), 'description': li_words(50, False)}
 data.close()

def generate_dataset_shelve ( filename , number_items = 1000 ) : if os . path . exists ( filename ) : os . remove ( filename ) data = shelve . open ( filename ) names = get_names ( ) totalnames = len ( names ) random . seed ( ) for i in range ( number_items ) : data [ str ( ( i + 1 ) ) ] = { 'name' : names [ random . randint ( 0 , ( totalnames - 1 ) ) ] , 'age' : random . randint ( 1 , 100 ) , 'description' : li_words ( 50 , False ) } data . close ( )
generate a dataset with number_items elements .