Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to find pdf file in link beautifulsoup

# Find links to pdf files in HTML with BeautifulSoup

import urllib2
from bs4 import BeautifulSoup
my_url = 'http://slav0nic.org.ua/static/books/python/'
html=urllib2.urlopen(my_url).read()
sopa = BeautifulSoup(html)
current_link = ''
for link in sopa.find_all('a'):
  current_link = link.get('href')
    if current_link.endswith('pdf'):
      print('Tengo un pdf: ' + current_link)
Comment

PREVIOUS NEXT
Code Example
Python :: 9x9 grid tkinter 
Python :: /n python 
Python :: debugging python 
Python :: how to capitalize words in python 
Python :: python find index 
Python :: pandas array of dataframes 
Python :: dataframe multiindex query 
Python :: python generalised eigenvalue problem 
Python :: inverse box-cox transformation python 
Python :: get sum of column before a date python 
Python :: how to set date and time rows in order python pandas 
Python :: python time.sleep 
Python :: python defaultdict default value 
Python :: unique file name in django 
Python :: #add,remove and clear all values on set in python 
Python :: pyton como identificar se é numero 
Python :: reverse a string or number in python 
Python :: graphics.py how to make a button 
Python :: discord.py add avatar to embed 
Python :: BST_Deleting 
Python :: plot the distribution of value_counts() python 
Python :: count unique values in python 
Python :: drop duplicates columns pandas 
Python :: python can you put try except in list comprehension 
Python :: Python RegEx Compile – re.compile() 
Python :: 151 - Power Crisis solution in python 
Python :: Python NumPy transpose Function Syntax 
Python :: how to set class attributes with kwargs python 
Python :: query first 5 element in django 
Python :: open textfile separated by whitespaces python 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =