Skip to content

Instantly share code, notes, and snippets.

View alixaprodev's full-sized avatar
🎯
Focusing

H. Ali alixaprodev

🎯
Focusing
View GitHub Profile
@alixaprodev
alixaprodev / remove-similiar-files.py
Created July 3, 2022 04:49
Delete all similiar files from a directory and sub directory in python
import os
def get_filepaths(directory):
file_paths = [] # List which will store all of the full filepaths.
# Walk the tree.
for root, directories, files in os.walk(directory):
for filename in files:
# Join the two strings in order to form the full filepath.
@alixaprodev
alixaprodev / scrape-imdb.py
Created April 21, 2022 10:27
web scrapping with requests-html in python
from requests_html import HTMLSession
session = HTMLSession()
url = "https://www.imdb.com/chart/top/?ref_=nv_mv_250"
response = session.get(url)
titles_es=response.html.find('.titleColumn')
for movie_title in titles_es:
print(movie_title.text)
@alixaprodev
alixaprodev / glob-example.py
Created April 20, 2022 09:15
search for all .py files inside a directory. It will find all python files available in subdirectores. It will search recursively. we have used glob module.
# author AlixaProDev
import glob
# path of the current directory
path = './'
curfiles = glob.glob(path + '**/*.py',recursive=True)
for file in curfiles:
print(file)
@alixaprodev
alixaprodev / alarm.py
Last active March 9, 2022 22:23
alarm.py is a simple alarm with python and tkinter.
'''
@author : alixaprodev.com
'''
from tkinter import *
import datetime
import time
import winsound
from threading import *
root = Tk()
root.geometry("400x200")
import requests
import urllib.request
import time
from bs4 import BeautifulSoup
url = 'https://www.amazon.com/s?k=python+books&ref=nb_sb_noss_2'
response = requests.get(url)
htmldata = BeautifulSoup(response.text, "html.parser")
print(htmldata)
h4tags=htmldata.findall('h4')
@alixaprodev
alixaprodev / spider.py
Created December 5, 2021 17:50
scrape website using python
import requests
import urllib.request
import time
from bs4 import BeautifulSoup
url = 'https://www.amazon.com/s?k=python+books&ref=nb_sb_noss_2'
response = requests.get(url)
htmldata = BeautifulSoup(response.text, "html.parser")
print(htmldata)