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 -*- | |
from tkinter import Tk, END, Entry, N, E, S, W, Button | |
from tkinter import font | |
from tkinter import Label | |
from functools import partial | |
def get_input(entry, argu): | |
entry.insert(END, argu) |
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 program to find current weather details of any city using openweathermap api | |
import requests | |
# Enter your API key here | |
api_key = "Your_API_Key" | |
# base_url variable to store url | |
base_url = "http://api.openweathermap.org/data/2.5/weather?" | |
# Give city name |
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 | |
import requests | |
status_dict = {"Website": "Status"} | |
def main(): | |
with open("websites.txt", "r") as fr: | |
for line in fr: | |
website = line.strip() | |
status = requests.get(website).status_code | |
status_dict[website] = "working" if status == 200 \ |
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 | |
# Trying to open a random wikipedia article | |
# Special:Random opens random articles | |
res = requests.get("https://en.wikipedia.org/wiki/Special:Random") | |
res.raise_for_status() | |
# pip install htmlparser | |
wiki = BeautifulSoup(res.text, "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 PIL import Image | |
import sys | |
import os | |
try: | |
im = None | |
for root, dirs, files in os.walk("."): | |
for filename in files: | |
if filename.endswith('.jpg'): | |
im = Image.open(filename).convert("RGB") |
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 gtts import gTTS | |
import os | |
file = open("abc.txt", "r").read() | |
speech = gTTS(text=file, lang='en', slow=False) | |
speech.save("voice.mp3") | |
os.system("voice.mp3") |
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 csv | |
import time | |
items=[] | |
driver=webdriver.Chrome(r"C:/Users/hp/Anaconda3/chromedriver.exe") | |
driver.get('https://www.youtube.com/watch?v=iFPMz36std4') | |
driver.execute_script('window.scrollTo(1, 500);') |
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 pandas as pd | |
import os | |
# Setting up session | |
s = requests.session() | |
# List contaiting all the films for which data has to be scraped from IMDB | |
films = [] |
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 zipfile | |
import sys | |
import os | |
# compress file function | |
def zip_file(file_path): | |
compress_file = zipfile.ZipFile(file_path + '.zip', 'w') | |
compress_file.write(path, compress_type=zipfile.ZIP_DEFLATED) | |
compress_file.close() |
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 tkinter as Tkinter | |
from datetime import datetime | |
counter = 0 | |
running = False | |
def counter_label(label): | |
def count(): | |
if running: | |
global counter |