A következő címkéjű bejegyzések mutatása: társadalom. Összes bejegyzés megjelenítése
A következő címkéjű bejegyzések mutatása: társadalom. Összes bejegyzés megjelenítése

2020. november 8., vasárnap

COVID statisztika letöltése és táblázatba exportálás Python szkript - covid2xls.py

Előkövetelmények:
  • Python 3
  • Két python könyvtár telepítése
    • pip3 install pandas 
    • pip3 install xlwt
 
Futtatás: python3 covid2xls.py

Kód:
 
import requests
import bs4
from bs4 import BeautifulSoup
import pandas as pd

#######################xlwt###########################

import xlwt
from xlwt import Workbook

wb = Workbook()

sheet1 = wb.add_sheet('Sheet 1')
sheet1.write(0, 0, 'Sorszám ')
sheet1.write(0, 1 ,'Nem')
sheet1.write(0, 2 ,'Kor')
sheet1.write(0, 3 ,'Alapbetegségek')

count=0

#######################xlwt###########################

for i in range(0,40):
    

    user_agent = 'Chrome/80.0.3987.132 Mozilla/5.0'
    response = requests.get(f"https://koronavirus.gov.hu/elhunytak?page={i}", stream=True,headers={'User-Agent': user_agent})

    soup = BeautifulSoup(response.text, 'html.parser')

    tables = soup.find_all('table')

    df = pd.read_html(str(tables))[0]

    print(df)

    for i in range(0,len(df["Sorszám"])):
        count=count+1
        sheet1.write(count, 0, str(df["Sorszám"][i]))
        sheet1.write(count, 1 ,str(df["Nem"][i]))
        sheet1.write(count, 2 ,int( df["Kor"][i]))
        sheet1.write(count, 3 ,str(df["Alapbetegségek"][i]))
        wb.save("out.xls")

2015. május 24., vasárnap

Richard Stallman: A Free Digital Society (podcast)

"There are many threats to freedom in the digital society. They include massive surveillance, censorship, digital handcuffs, nonfree software that controls users, and the War on Sharing. Other threats come from use of web services. Finally, we have no positive right to do anything in the Internet; every activity is precarious, and can continue only as long as companies are willing to cooperate with it."

https://archive.org/details/freedigitalsociety20150522