Python to filter a comma-separated list on another csv list
<p>I have two strings:</p>

<pre><code>s1 = "Brendon, Melissa, Jason, , McGuirk" #the gauranteed string in format "x, y, z"
s2 = "brandon,melissa,jxz  ,paula,coach" #the messy string
</code></pre>

<p>and would like to create a Python (2.7) list that uses the value in l1 if it exists, otherwise pass through the value in l2.  I have working code, but even with the list comprehensions, I feel like there may be a more Pythonic way of doing this.  Any ideas what that might be?</p>

<pre><code>l1 = [x.strip() for x in s1.split(',')]
l2 = [x.strip() for x in s2.split(',')]
f = lambda s: s[1] if s[1] else s[0]
final = [f(x) for x in zip(l2, l1)]
</code></pre>

<p>The list "final" now contains:</p>

<pre><code>['Brendon', 'Melissa', 'Jason', 'paula', 'McGuirk']
</code></pre>

<p>Which is correct.</p>

<p>------- edit
So, looking at Jon's answer below, a or b seems like the simplest, most readable approach.  I moved the string cleaning to a small function, and ended up with this.  Any further improvements to make?</p>

<pre><code>trim_csv = lambda csv: [s.strip() for s in csv.split(',')]
print [a or b for a, b in zip(trim_csv(s1), trim_csv(s2))]
</code></pre>
