View difference between Paste ID: TnPVXxhJ and aRNiw8M0
SHOW: | | - or go back to the newest paste.
1-
import requests, re
1+
import os
2-
from matplotlib import pyplot as plt
2+
3-
from matplotlib.ticker import EngFormatter
3+
def get_factorial(n):
4-
from bs4 import BeautifulSoup
4+
    # terminate function
5
    if n < 2:
6-
def main(url):
6+
        return n
7
8-
    result = requests.get(url)
8+
    else: #recursion
9-
    status = result.status_code
9+
        return n * get_factorial(n-1)
10
11-
    # status = 404
11+
# print( get_factorial(7) )
12-
    assert status == 200, f"Site Error: Status Code {status}"
12+
13
# get all files in subfolders
14-
    data = get_data(result.content)
14+
def get_all_files(root_folder, file_list=[]):
15-
    draw_data(data)
15+
    all_content = [os.path.join(root_folder, i) for i in os.listdir(root_folder)]
16
17-
def get_data(source):
17+
    # get files from current folder
18-
    """
18+
    file_list += [i for i in all_content if os.path.isfile(i)]
19-
    Gets a html source (str) and parses it with BeautifulSoup
19+
20-
    :param source: str()
20+
    subfolders = [i for i in all_content if os.path.isdir(i)]
21-
    :return: dict()
21+
22-
    """
22+
    for folder in subfolders:
23
        get_all_files(folder)
24-
    soup = BeautifulSoup(source, 'lxml')
24+
25-
    page_title = soup.title.text
25+
    return file_list
26
27-
    columns = soup.find_all('div', class_="oszlop")
27+
28
all_files = get_all_files(r"E:\Photos")
29-
    day_list = []
29+
for i in all_files:
30-
    temp_mins = []
30+
    print(i)