I'm learning Python by converting some old scripts from PHP to Python, and I'm stuck with something I can solve in PHP.
I have 3 lists of data (fetched via SNMP). In PHP, I'm storing them like so:
$array['12345']['user'] = 'example@example.com';
$array['12345']['int_id'] = 1;
$array['12345']['int_speed'] = 1238745;
$array['51245']['user'] = 'example@example.com';
$array['51245']['int_id'] = 2;
$array['51245']['int_speed'] = 5151244;
As I have 3 lists, I'm doing 3 sets of processing. The first run fetches a list of all usernames and user IDs (12345/51245 above), meaning I can set the first part of the array. I can then process the other two lists of data, and in PHP they'd be assigned like so (in a foreach, probably):
$array[$user_id]['int_id'] = $int_id;
$array[$user_id]['int_speed'] = $int_speed;
Trying to replicate this behaviour on Python is becoming quite tricky, I'm presuming what I want to do is create a dictionary of lists? But then I'm not sure how I add/edit these lists or cycle through them getting all the values of each layer of the array in turn.