Q:

Getting indices of list based on a second list

I have a list a which contains all the possible values in list b
a = ['foo', 'bar', 'baz']

and 
b = ['baz', 'baz', 'foo', 'foo', 'foo', 'bar', 'foo', 'baz']

I'd like to return a list c which has the number of elements found in b where each element is the index of a in for which the value of b can be found.
Example
c = [2, 2, 0, 0, 0, 1, 0, 2]

A:

One-liner:
c = [a.index(x) for x in b]

