Exemplo n.º 1
0
for i in range(0,5):
	print(fake.CustomerCode()) #cid
	print(fake.random_int(min=1, max=12)) #orderID
	#
	print(fake.date()) #orderDate
	print(fake.time()) #orderTime
	print(fake.random_digit_not_null()) #qty
	print(fake.random_int(min=7, max=15)) #price
	print(fake.foodCode()) #foodID
	print("--------------------------------------------")
'''

#Dumping JSON data in a text file
data = {}
fo = open("data_in_json.json", "w")
for i in range(0, 5):
    data['Cid'] = fake.CustomerCode()
    data['order_id'] = fake.random_int(min=1, max=12)
    #orderDate=fake.date()
    #orderTime=fake.time()
    data['date'] = fake.date()
    data['time'] = fake.time()
    data['qty'] = fake.random_digit_not_null()
    data['price'] = fake.random_int(min=7, max=15)
    data['food_id'] = fake.foodCode()

    json_data = json.dumps(data)

    fo.write(json_data)
fo.close()
Exemplo n.º 2
0
#Dumping JSON data in a text file
data={'Cid': [], 'order_id': []}

#data['user_history']=[]
#data['user_history']['order_id']=[[]]
'''
data = {}

data['Cid']=Cid
'''

fo = open("data_in_userHistory.json","w")
for i in range(0,7):
	NoOfOrders=randint(1, 9)
	Cid='%s'%(fake.CustomerCode())
	while(Cid in PreviousCustomers):
		Cid='%s'%(fake.CustomerCode())
	data['Cid']=Cid
	PreviousCustomers.append(Cid)

	#for j in range(0,NoOfOrders):
	order_id=random.sample(range(1,100),NoOfOrders)
	#print(order_id)

	common=common_member(PreviousOrders,order_id)
	if(common!=-1):
		for item in common:
			order_id.remove(item)
	#print(common)
	#print(order_id)