1. SpeedTest with Python
This advanced script will let you test your Internet Speed with Python. Simply you need to install speed test modules and run the following code.
# pip install pyspeedtest
# pip install speedtest
# pip install speedtest-cli#method 1
import speedtestspeedTest = speedtest.Speedtest()
print(speedTest.get_best_server())#Check download speed
print(speedTest.download())#Check upload speed
print(speedTest.upload())# Method 2import pyspeedtest
st = pyspeedtest.SpeedTest()
st.ping()
st.download()
st.upload()
15 Basic Python Libraries for Machine Learning You Need to Know.
It took me way too long to make this article
faun.pub
What is Polymorphism in Python?
Python is one of the most popular programming languages due to its versatility and its user-friendly syntax. Like other…
pythonians.medium.com
2. Search on Google
You can extract the Redirect URLs from Google Search Engine. Install the following mention module and follow the Code.
# pip install googlefrom googlesearch import searchquery = "Medium.com"
for url in search(query):
print(url)
3. Make Web Bot
This script will help you to automate Websites with Python. You can build a web bot that can control any website. Check out the below code. This script is handy in web scraping and web automation.
# pip install selenium
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keysbot = webdriver.Chrome("chromedriver.exe")
bot.get('http://www.google.com')search = bot.find_element_by_name('q')
search.send_keys("@codedev101")
search.send_keys(Keys.RETURN)
time.sleep(5)
bot.quit()
SQL Window Functions
CLAUSES AND LIST FUNCTIONS
pythonians.medium.com
Python Collection of Basics and Tricky Questions
Table of Contents:
pythonians.medium.com
4. Fetch Song Lyrics
This advanced script will show you how to fetch lyrics from any song. First, you had to get an API key that is free from the Lyricsgenius website, and then you had to follow the below code.
# pip install lyricsgeniusimport lyricsgeniusapi_key = "xxxxxxxxxxxxxxxxxxxxx"genius = lyricsgenius.Genius(api_key)
artist = genius.search_artist("Pop Smoke",
max_songs=5,sort="title")
song = artist.song("100k On a Coupe")print(song.lyrics)
5. Get Exif Data of Photos
Get Exif Data of any Photo with Python Pillow module. Check out the below mention code. I gave two methods to extract Exif Data of Photos.
# Get Exif of Photo# Method 1
# pip install pillow
import PIL.Image
import PIL.ExifTags
img = PIL.Image.open("Img.jpg")
exif_data =
{
PIL.ExifTags.TAGS[i]: j
for i, j in img._getexif().items()
if i in PIL.ExifTags.TAGS
}
print(exif_data)# Method 2
# pip install ExifRead
import exifreadfilename = open(path_name, 'rb')tags = exifread.process_file(filename)
print(tags)
6. OCR Text from Image
OCR is a method to recognize text from digital and scanned documents. Many Developers use it to read handwritten data. Below Python Code will help you convert scanned images to OCR text format.
Note: You had to download tesseract.exe from Github
# pip install pytesseract
import pytesseract
from PIL import Image
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
t=Image.open("img.png")
text = pytesseract.image_to_string(t, config='')print(text)
Python Collection of Basics and Tricky Questions
Table of Contents:
pythonians.medium.com
7. Convert Photo into Cartonize
This simple advanced script will convert your Photo into Cartonize format. Check out the below example code and Try it.
# pip install opencv-pythonimport cv2
img = cv2.imread('img.jpg')
grayimg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
grayimg = cv2.medianBlur(grayimg, 5)
edges = cv2.Laplacian(grayimg , cv2.CV_8U, ksize=5)r,mask =cv2.threshold(edges,100,255,cv2.THRESH_BINARY_INV)img2 = cv2.bitwise_and(img, img, mask=mask)
img2 = cv2.medianBlur(img2, 5)
cv2.imwrite("cartooned.jpg", mask)
Python Project Ideas For Beginners
NO PROGRAMMING CODES(GOOD FOR PRACTISE)
pythonians.medium.com
8. Empty Recycle Bin
This simple script will let you empty your recycle bin with Python. Check out the below code to know how to do it.
# pip install winshellimport winshell
try:
winshell.recycle_bin().empty(confirm=False, /show_progress=False, sound=True)
print("Recycle bin is emptied Now")
except:
print("Recycle bin already empty")
9. Python Image Enhancement
Enhance your Photo to make it look better using the Python Pillow library. In the Below code, I had implemented the four methods to enhance any photo.
# pip install pillowfrom PIL import Image,ImageFilter
from PIL import ImageEnhance
im = Image.open('img.jpg')
# Choose your filter
# add Hastag at start if you don't want to any filter below
en = ImageEnhance.Color(im)
en = ImageEnhance.Contrast(im)
en = ImageEnhance.Brightness(im)
en = ImageEnhance.Sharpness(im)# result
en.enhance(1.5).show("enhanced")
I Made a Python Bot to Send “Good Night” Texts to My GF
Here’s how you too can build it very easily.
pythonians.medium.com
A Quick Introduction to the Programming Terms: Python Complete Course
Introduction
to the Programming Terms: Python Complete Course Introductionpythonians.medium.com
10. Get Window Version
This simple script will let you get the full window version you are currently using.
# Window Versionimport wmi
data = wmi.WMI()
for os_name in data.Win32_OperatingSystem():
print(os_name.Caption)# Microsoft Windows 11 Home
Python Collection of Basics and Tricky Questions
Table of Contents:
pythonians.medium.com
11. Convert PDF to Images
Convert all Pages of Pdf to Images with the following piece of code.
# PDF to Imagesimport fitzpdf = 'sample_pdf.pdf'
doc = fitz.open(pdf)
for page in doc:
pix = page.getPixmap(alpha=False)
pix.writePNG('page-%i.png' % page.number)
12. Convertion: Hex to RGB
This script will simply convert Hex to RGB. Check out the below example code.
# Conversion: Hex to RGBdef Hex_to_Rgb(hex):
h = hex.lstrip('#')
return tuple(int(h[i:i+2], 16) for i in (0, 2, 4))print(Hex_to_Rgb('#c96d9d')) # (201, 109, 157)
print(Hex_to_Rgb('#fa0515')) # (250, 5, 21)
5 Killer Automation Scripts in Python
Here are some awesome automation scripts that you can use in your Python projects.
pythonians.medium.com
A Quick Introduction to the Programming Terms: Python Complete Course
Introduction
to the Programming Terms: Python Complete Course Introductionpythonians.medium.com
13. Web Status
You can check the website is up or down with Python. Check the following code, 200 status means the website is Up and if you got 404 status that means the website is down.
# pip install requests#method 1import urllib.request
from urllib.request import Request, urlopenreq = Request('https://medium.com/@pythonians', headers={'User-Agent': 'Mozilla/5.0'})
webpage = urlopen(req).getcode()
print(webpage) # 200# method 2import requests
r = requests.get("https://medium.com/@pythonians")
print(r.status_code) # 200