[Tutor] Lost in the control flow
Eduardo Vieira
eduardo.susan at gmail.com
Tue Aug 10 21:39:50 CEST 2010
Hello, list! I'm trying to parse a text file. I'm getting confuse with
my strategy, and flags or how to use a sequence of ifs or elifs,
continue, etc. Anyhow, after several experiments this is close to what
I'd like to get, except, I can't find a way to include all the pin
numbers (12 number sequence):
Here is my code:
http://pastebin.com/1ps6WdF4
The example file is this:
http://pastebin.com/1MZmE4d3
Basically, as a initial step, I'd like to transform this:
17 600775301465 CAREYON SIGNS & GRAPHICS EXP 5
93.00 $0.00 $ 26.77
RED DEER AB T4N1L2
FUEL SURCHARGE: 2.10
GST/HST: 1.44
600775301465 18.60
600775301473 18.60
600775301481 18.60
into this. View the code and file for details, please:
{'city': 'AB', 'company': 'CAREYON SIGNS & GRAPHICS', 'tracking':
['600775301465', '600775301473', '600775301481', ], 'id': '17'}
The way the code is working now I only get this:
{'city': 'AB', 'company': 'CAREYON SIGNS & GRAPHICS', 'tracking':
['600775301465', '600775301465'], 'id': '17'}, and a only the ones
that have multiple pin numbers.
I'd appreciate your help. Thanks.
Eduardo
More information about the Tutor
mailing list