Python append 1 to list if condition exist and 0 to all other lists
<p>I have 3 lists:</p>

<pre><code>a_exist = []
b_exist = []
c_exist = []
</code></pre>

<p>i am looping through a main list of strings:</p>

<pre><code>l = ['a', 'b']

for item in l:

    if 'a' in item:

        a_exist.append(1)
        b_exist.append(0)
        c_exist.append(0)

    else:

        a_exist.append(0)
        b_exist.append(0)
        c_exist.append(0)

    if 'b' in item:

        b_exist.append(1)
        a_exist.append(0)
        c_exist.append(0)

    else:

        b_exist.append(0)
        a_exist.append(0)
        c_exist.append(0)
</code></pre>

<p>What i am trying to get:</p>

<pre><code>a_exist = [1,0]
b_exist = [0,1]
c_exist = [0,0]
</code></pre>

<p>Is there a better way of doing this?</p>