title: Python & Beautifulsoup 4 - Unable to filter classes?
body: <p>I'm trying to scrape shoe sizes from this URL:
  <a href="http://www.jimmyjazz.com/mens/footwear/jordan-retro-13--atmosphere-grey-/414571-016?color=Grey" rel="nofollow noreferrer">http://www.jimmyjazz.com/mens/footwear/jordan-retro-13--atmosphere-grey-/414571-016?color=Grey</a></p>
  
  <p>What I'm trying to do is get only the sizes that are available, e.g. only those that aren't greyed out.</p>
  
  <p>The sizes are all wrapped in <code>a</code> elements. The available sizes are of <code>box</code> class, and the unavailable ones are of <code>box piunavailable</code> class.</p>
  
  <p>I have tried using a lambda function, ifs and CSS selectors - none seem to work. My guess it's because of the way my code is structured.</p>
  
  <p>The way it's structured is as follows:</p>
  
  <p>The <code>if</code> attempt</p>
  
  <pre><code>size = soup2.find('div', attrs={'class': 'psizeoptioncontainer'})
  getsize = str([e.get_text() for e in size.findAll('a', attrs={'class': 'box'}) if 'piunavailable' not in e.attrs['class']])
  </code></pre>
  
  <p>The lambda attempt</p>
  
  <pre><code>size = soup2.find('div', attrs={'class': 'psizeoptioncontainer'})
  getsize = str([e.get_text() for e in size.findAll(lambda tag: tag.name == 'a' and tag.get('class') == ['box piunavailable'])])
  </code></pre>
  
  <p>The CSS selector attempt</p>
  
  <pre><code>size = soup2.find('div', attrs={'class': 'psizeoptioncontainer'})
  getsize = str([e.get_text() for e in size.findAll('a[class="box"]'))
  </code></pre>
  
  <p>So, for the URL provided, I am expecting the results to be a string (converted from list) that is all available sizes - at the time of writing this question, it should be - <code>'8', '8.5', '9', '9.5', '10', '10.5', '11', '11.5', '13'</code></p>
  
  <p>Instead, I'm getting all sizes, <code>'7.5', '8', '8.5', '9', '9.5', '10', '10.5', '11', '11.5', '12', '13'</code></p>
  
  <p>Anyone have an idea how to make it work (or know an elegant solution to my issue)? Thank you in advance!</p>