Python Learning: Automate Boring Stuff with Python | Chapter 13: PDF Paranoia

“Paranoid? Probably. But just because you’re paranoid doesn’t mean there isn’t an invisible demon about to eat your face.” scary… 9:13:00 PM my solution # usage pdf_paranoia_encrypt.py import PyPDF2 import os import sys import logging logging.basicConfig(level=logging.DEBUG, format=”%(asctime)s – %(levelname)s – %(message)s”) # TODO: GET PASSWORD FROM COMMAND LINE if len(sys.argv) == 2: # TODO: OS WALK […]

“Python Learning: Automate Boring Stuff with Python | Chapter 11 : My Solution to Image Downloader from Imgur

So you want to download images without a browser..  challenge accepted 3:43:41 PM   #Image Site Downloader #USAGE: python igmurdownloader.py <category> <limit> import sys, requests, os, logging, bs4, re logging.basicConfig(level=logging.DEBUG, format="%(asctime)s – %(levelname)s – %(message)s") logging.disable(logging.CRITICAL) if len(sys.argv) == 3: logging.info("Command line argument 3") #TODO: get category, and limit category = sys.argv[1] limit = sys.argv[2] imgur […]

“Python Learning: Automate Boring Stuff with Python | Chapter 8 : My Solution to Practice Project: Filling in the Gaps

How to fill in the gaps 1:49:09 AM I need help with this! I like this exercise but I cannot seem to find its ideal solution. Could someone suggest in pseudocode, please..? # finds files with a give prefix in a folder # locates any gaps in the numbering # renames all the later files to […]

Python Learning: Automate Boring Stuff with Python | Chapter 8 : My Solution to Practice Project: Deleting Unneeded Files

Personally, one of the simplest projects yet This code (when properly indented) helps to list out all files with a size greater than the given limit.   # Usage python big.py limit in MB import sys import os if len(sys.argv) >= 2: limit = sys.argv[1] if len(sys.argv) == 3: source = sys.argv[2] else: source = […]

Python Learning: Automate Boring Stuff with Python | Chapter 8 : My Solution to Project: Backing Up a Folder into a Zip File

Just my solution to the project I found the solution to the project provided in the book really good, but it zipped the entire folder structure in the absolute path. Something I am not pleased with. By adding the filepath base name to the zipfile.Zipfile.write() function, after the absolute file path (of the file to […]