FRIKIdelTO

bs4 Amazon

Mar 7th, 2020
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. PARTIENDO DE ESTO:
  2.  
  3. </style>
  4. </div>
  5. <div class="a-section a-spacing-none feature t-prnt t-full" data-feature-name="cerberus" data-template-name="cerberus" id="cerberus_feature_div">
  6. <div data-asin="B07JP63R7S" data-asin-currency-code="EUR" data-asin-price="108.82" data-asin-shipping="7.00" data-device-type="MOBILE" data-display-code="Asin is not eligible because it is price competitive" data-substitute-count="-1" id="cerberus-data-metrics" style="display: none;"></div>
  7. </div>
  8. <div class="a-section a-spacing-none feature t-prnt t-full" data-feature-name="prsubswidget" data-template-name="prsubswidget" id="prsubswidget_feature_div">
  9. </div>
  10. <div id="productTitleGroupAnchor"></div>
  11.  
  12. QUIERO OBTENER EL DATO "7.00" QUE ESTÁ EN "data-asin-shipping"
  13.  
  14. HACIENDO ESTO LO OBTENGO:
  15. for divs in soup.find_all('div'):
  16.     try:
  17.         gastos = str(divs['data-asin-shipping'])
  18.         break
  19.     except:
  20.         pass
  21.  
  22. PERO ME GUSTARÍA SABER SI HAY UNA FORMA DIRECTA DE OBTENERLO SIN TENER QUE HACER USO DE UN BUCLE
Advertisement
Add Comment
Please, Sign In to add comment