[Tutor] Lost in the control flow

Eduardo Vieira eduardo.susan at gmail.com
Wed Aug 11 19:14:15 CEST 2010


On Tue, Aug 10, 2010 at 1:56 PM, Adam Bark <adam.jtm30 at gmail.com> wrote:

>
> The problem is you don't call make_dict unless there's a "FUEL SURCHARGE" or
> multiple pins. Also you don't add the first pin to mydict["tracking"] unless
> there's a "FUEL SURCHARGE".
>
> HTH,
> Adam.
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>

Hi, I made these changes, got rid of the functions, and changed some logic:
here is the link: http://pastebin.com/F19vKUjr

Now mydict will be changing, of course with every loop, as the output below:
{'company': 'CITY SIGNS', 'tracking': ['600775301143'], 'id': '1'}
{'city': 'MEDICINE HAT', 'company': 'CITY SIGNS', 'tracking':
['600775301143'], 'id': '1', 'prov': 'AB'}
{'city': 'MEDICINE HAT', 'company': 'TRIMLINE', 'tracking':
['600775301150'], 'id': '2', 'prov': 'AB'}
{'city': 'ROCKY MOUNTAIN HOUSE', 'company': 'TRIMLINE', 'tracking':
['600775301150'], 'id': '2', 'prov': 'AB'}
{'city': 'ROCKY MOUNTAIN HOUSE', 'company': 'TS SIGNS PRINTING &
PROMO', 'tracking': ['600775301168'], 'id': '3', 'prov': 'AB'}
{'city': 'FORT MCMURRAY', 'company': 'TS SIGNS PRINTING & PROMO',
'tracking': ['600775301168'], 'id': '3', 'prov': 'AB'}
{'city': 'FORT MCMURRAY', 'company': 'TS SIGNS PRINTING & PROMO',
'tracking': ['600775301168', '600775301168'], 'id': '3', 'prov': 'AB'}
{'city': 'FORT MCMURRAY', 'company': 'TS SIGNS PRINTING & PROMO',
'tracking': ['600775301168', '600775301168', '600775301176'], 'id':
'3', 'prov': 'AB'}
{'city': 'FORT MCMURRAY', 'company': 'TS SIGNS PRINTING & PROMO',
'tracking': ['600775301168', '600775301168', '600775301176',
'600775301184'], 'id': '3', 'prov': 'AB'}
{'city': 'FORT MCMURRAY', 'company': 'TS SIGNS PRINTING & PROMO',
'tracking': ['600775301168', '600775301168', '600775301176',
'600775301184', '600775301192'], 'id': '3', 'prov': 'AB'}
{'city': 'FORT MCMURRAY', 'company': 'TS SIGNS PRINTING & PROMO',
'tracking': ['600775301168', '600775301168', '600775301176',
'600775301184', '600775301192', '600775301200'], 'id': '3', 'prov':
'AB'}
so I appended everything to a bigdata list and used it to update the
dictionary data_dict

I can't understand why I get only one value:
{'18': {'city': 'ESTEVAN',
        'company': 'BRAKE & DRIVE SYSTEMS',
        'id': '18',
        'prov': 'SK',
        'tracking': ['600775301515', '600775301515', '600775301523']}}

Regards,

Eduardo


More information about the Tutor mailing list