# -*- coding: utf-8 -*-
import random, pprint
user = {}
USERINFO_STRUCT = {
'id': '',
}
def client_new(id):
global user
newuser = USERINFO_STRUCT
newuser['id'] = id
user[id] = newuser
pprint.pprint(user)
print ""
client_new(1)
client_new(2)
client_new(3)
I want results:
{1: {'id': 1}}
{1: {'id': 1}, 2: {'id': 2}}
{1: {'id': 1}, 2: {'id': 2}, 3: {'id': 3}}
The results of that code execution is:
{1: {'id': 1}}
{1: {'id': 2}, 2: {'id': 2}}
{1: {'id': 3}, 2: {'id': 3}, 3: {'id': 3}}
How are you doing this?
My machine is Debian Linux 8.6 (Python 2.7.9).