Tag: folder structure

Coding

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 [sourcecode language=”python”] #usage pdf_paranoia_encrypt.py <password> import PyPDF2, os, sys, 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 FROM CURRENT DIRECTORY […]

Coding

“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   [sourcecode language=”python”] #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 = […]

Coding

“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..? [sourcecode language=”python” wraplines=”false” collapse=”false”] #finds files with a give prefix in a folder #locates any gaps in the numbering #renames all the later files […]

Coding

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.   [sourcecode language=”python” wraplines=”false” collapse=”false”] #Usage python big.py limit in MB <source> import sys, os if len(sys.argv) >= 2: limit = sys.argv[1] source = sys.argv[2] if len(sys.argv) == 3 […]

Coding

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 filepath (of the file to be […]