Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python web parser

List_of_dataframes = pd.read_html('https://en.wikipedia.org/wiki/ISO_3166-1')
Comment

python web parse

#Scrapes Python's URL, version number and logo from its Wikipedia page:

# $ pip3 install requests beautifulsoup4
import requests, bs4, os, sys

URL = 'https://en.wikipedia.org/wiki/Python_(programming_language)'
try:
    html       = requests.get(URL).text
    document   = bs4.BeautifulSoup(html, 'html.parser')
    table      = document.find('table', class_='infobox vevent')
    python_url = table.find('th', text='Website').next_sibling.a['href']
    version    = table.find('th', text='Stable release').next_sibling.strings.__next__()
    logo_url   = table.find('img')['src']
    logo       = requests.get(f'https:{logo_url}').content
    filename   = os.path.basename(logo_url)
    with open(filename, 'wb') as file:
        file.write(logo)
    print(f'{python_url}, {version}, file://{os.path.abspath(filename)}')
except requests.exceptions.ConnectionError:
    print("You've got problems with connection.", file=sys.stderr)
Comment

web parser python

import requests
from bs4 import BeautifulSoup as bs

page = requests.get("https://library.gabia.com/")
soup = bs(page.text, "html.parser")

elements = soup.select('div.esg-entry-content a > span')

for index, element in enumerate(elements, 1):
		print("{} 번째 게시글의 제목: {}".format(index, element.text))
Comment

PREVIOUS NEXT
Code Example
Python :: python convert date to timestamp 
Python :: train_test_split sklearn 
Python :: pyside 
Python :: python collections Counter sort by key 
Python :: strip first occurence of substring python 
Python :: django save image 
Python :: mailchimp send email python 
Python :: python find object with attribute in list 
Python :: python remove characters from end of string 
Python :: how to do swapping in python without 
Python :: pandas index to datetime 
Python :: check if all characters in a string are the same python 
Python :: best python ide for ubuntu 
Python :: tkinter allign 
Python :: python grid 
Python :: how to convert into grayscale opencv 
Python :: check remote port is open or not using python 
Python :: how to uninstall python2.7 from ubuntu 18.04 
Python :: pandas map using two columns 
Python :: remove ,drop,effacer, dataframe,python 
Python :: length of set python 
Python :: python slice a dict 
Python :: kivy change window size 
Python :: unittest skip 
Python :: random split train test in python 
Python :: strftime 
Python :: tkinter simple notification 
Python :: create requirement .txt 
Python :: python function get number of arguments 
Python :: access row of dataframe 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =