I have a file with lines of data. Each line starts with an id, followed by fixed set of attributes separated by comma.
123,2,kent,...,
123,2,bob,...,
123,2,sarah,...,
123,8,may,...,
154,4,sheila,...,
154,4,jeff,...,
175,3,bob,...,
249,2,jack,...,
249,5,bob,...,
249,3,rose,...,
I would like to get an attribute if the conditions are met. The conditions are if 'bob' appears within the same id, get the value of the second attribute that follows.
For example:
id: 123
values returned: 2, 8
id: 249
values returned: 3
Java has a double loop I can use, but I would like to try this in Python. Any suggestions would be great.