import pyttsx3
import PyPDF2
pdfreader = PyPDF2.PdfFileReader(open('story.pdf','rb'))
speaker = pyttsx3.init()
for page_num in range(pdfreader.numPages):
text = pdfreader.getPage(page_num).extractText() ## extracting text from the PDF
cleaned_text = text.strip().replace('\n',' ') ## Removes unnecessary spaces and break lines
print(cleaned_text) ## Print the text from PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tqdm import tqdm | |
from PIL import Image | |
import os | |
from time import sleep | |
def Resize_image(size, image): | |
if os.path.isfile(image): | |
try: | |
im = Image.open(image) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get Ipaddress and Hostname of Website | |
# importing socket library | |
import socket | |
def get_hostname_IP(): | |
hostname = input("Please enter website address(URL):") | |
try: | |
print (f'Hostname: {hostname}') | |
print (f'IP: {socket.gethostbyname(hostname)}') | |
except socket.gaierror as error: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
import requests as rq | |
import os | |
from bs4 import BeautifulSoup | |
import time | |
# path= E:\web scraping\chromedriver_win32\chromedriver.exe | |
path = input("Enter Path : ") | |
url = input("Enter URL : ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install psutil | |
import psutil | |
battery = psutil.sensors_battery() | |
plugged = battery.power_plugged | |
percent = battery.percent | |
if percent <= 30 and plugged!=True: | |
# pip install py-notifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import time | |
from calendar import isleap | |
# judge the leap year | |
def judge_leap_year(year): | |
if isleap(year): | |
return True | |
else: | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import shutil | |
os.chdir("E:\downloads") | |
#print(os.getcwd()) | |
#check number of files in directory | |
files = os.listdir() | |
#list of extension (You can add more if you want) | |
extentions = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from email.message import EmailMessage | |
import smtplib | |
def get_credentials(filepath): | |
with open("credentials.txt", "r") as f: | |
email_address = f.readline() | |
email_pass = f.readline() | |
return (email_address, email_pass) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python script to PDF to Audio | |
import pyttsx3 | |
import PyPDF2 | |
pdfreader = PyPDF2.PdfFileReader(open('story.pdf','rb')) | |
speaker = pyttsx3.init() | |
for page_num in range(pdfreader.numPages): | |
text = pdfreader.getPage(page_num).extractText() ## extracting text from the PDF | |
cleaned_text = text.strip().replace('\n',' ') ## Removes unnecessary spaces and break lines | |
print(cleaned_text) ## Print the text from PDF | |
#speaker.say(cleaned_text) ## Let The Speaker Speak The Text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import email | |
import python-imap | |
EMAIL = 'mymail@mail.com' | |
PASSWORD = 'password' | |
SERVER = 'imap.gmail.com' | |
# connect to the server and go to its inbox | |
mail = imaplib.IMAP4_SSL(SERVER) | |
mail.login(EMAIL, PASSWORD) |