Mercurial > hg > nsaunier > traffic-intelligence
comparison python/ubc_utils.py @ 53:0a5bdbf0d1b4
added comments
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Wed, 13 Oct 2010 19:02:45 -0400 |
| parents | 441c8387f34f |
| children | b8b3768f8d54 |
comparison
equal
deleted
inserted
replaced
| 52:441c8387f34f | 53:0a5bdbf0d1b4 |
|---|---|
| 37 | 37 |
| 38 if (inFilename.find('features') >= 0) or (not infile) or (not outfile): | 38 if (inFilename.find('features') >= 0) or (not infile) or (not outfile): |
| 39 return | 39 return |
| 40 | 40 |
| 41 lines = utils.getLines(infile) | 41 lines = utils.getLines(infile) |
| 42 objNum = 0 | 42 objNum = 0 # in inFilename |
| 43 while lines != []: | 43 while lines != []: |
| 44 # find object in objects (index i) | |
| 44 i = 0 | 45 i = 0 |
| 45 while (i<len(objects)) and (objects[i].num != objNum): | 46 while (i<len(objects)) and (objects[i].num != objNum): |
| 46 i+=1 | 47 i+=1 |
| 48 | |
| 47 if i<len(objects): | 49 if i<len(objects): |
| 48 l = lines[0].split(' ') | 50 l = lines[0].split(' ') |
| 49 l[3] = str(objects[i].userType) | 51 l[3] = str(objects[i].userType) |
| 50 outfile.write(' '.join(l)+'\n') | 52 outfile.write(' '.join(l)+'\n') |
| 51 for l in lines[1:]: | 53 for l in lines[1:]: |
