How to create a list from another list using specific criteria in Python?
<p>How can I create a list from another list using python?
If I have a list:</p>

<pre><code>input = ['a/b', 'g', 'c/d', 'h', 'e/f']
</code></pre>

<p>How can I create the list of only those letters that follow slash "/" i.e.</p>

<pre><code>desired_output = ['b','d','f']
</code></pre>

<p>A code would be very helpful.</p>

<pre><code>&gt;&gt;&gt;  input = ["a/b", "g", "c/d", "h", "e/f"]
&gt;&gt;&gt;  output=[]
&gt;&gt;&gt;  for i in input:
         if '/' in i:
             s=i.split('/')
             output.append(s[1])

&gt;&gt;&gt;  output
['b', 'd', 'f']
</code></pre>

python list