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 bs4 import BeautifulSoup | |
import requests | |
import re | |
search_term = input("What product do you want to search for? ") | |
url = f"https://www.newegg.ca/p/pl?d={search_term}&N=4131" | |
page = requests.get(url).text | |
doc = BeautifulSoup(page, "html.parser") |
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 dbmodule import connect | |
#create connection with object | |
connection = connect('databasename','username','password') | |
#create a cursor object | |
cursor = connection.cursor() | |
#Run queries | |
cursor.execute('select * from mytable') |
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 random, string | |
def password(length, num=false,strength='weak'): | |
"""length of password, num if you want a number and strength(weak, strong,very)""" | |
lower = string.ascii_lowercase | |
upper = string.ascii_uppercase | |
letter = lower + upper | |
dig = string.digits | |
punct = string.punctuation | |
pwd = ' ' |
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 pyttsx3 | |
import PyPDF2 | |
pdf_book = open('book.pdf','rb') | |
pdf_book_reader = PyPDF2.PdfFileReader(pdf_book) | |
pages_no = pdf_book_reader.numPages | |
print(pages_no) | |
speaker = pyttsx3.init() | |
for number in range(8,pages_no): | |
page_start = pdf_book_reader.getPage(8) | |
text = page_start.extractText() |
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
#Install all the below mention librarie before using pandas-profiling | |
import pandas as pd | |
import numpy as np | |
from pandas_profiling import ProfileReport | |
#EDA using pandas-profiling | |
profile = ProfileReport(pd.read_csv('titanic.csv'),title='Pandas Profiling Report',html={'style': {'full_width': True}}, sort="None")) | |
#to view result in jupyter notebook or google colab | |
profile.to_widgets() |