Tag: file manipulation

Coding

Python Learning: Automate Boring Stuff with Python | Chapter 15: Scheduled Web Comic Downloader

Book The world is indeed comic, but the joke is on mankind. H. P. Lovecraft true.. true.. 6:23:15 PM I made different functions to handle a specific (one) task; Division of labor [sourcecode language=”python”]</p> <p>#usage python download_lefthand_comic.py<br> import logging, os, requests, bs4,time, re</p> <p>logging.basicConfig(level=logging.DEBUG, format="%(asctime)s – %(levelname)s – %(message)s")</p> <p>comic_directory = os.path.join("c:\\", "comicbooks", "lefthandedtoons")<br> comic_directory = […]

Coding

Python Learning: Automate Boring Stuff with Python | Chapter 14: Excel-to-CSV Converter

And where I excel is ridiculous, sickening, work ethic. You know, while the other guy’s sleeping? I’m working. Will Smith I like will smith!! 12:50:11 AM   This task was unexpectedly difficult for me, so I am not sure if it is correct [sourcecode language=”python”] #USAGE python excel_2_csv.py import openpyxl, os, sys, logging, csv logging.basicConfig(level=logging.DEBUG, format="%(asctime)s […]

Coding

Python Learning: Automate Boring Stuff with Python | Chapter 13: Brute-Force PDF Password Breaker

“I can stand brute force, but brute reason is quite unbearable. There is something unfair about it’s use. It is hitting below the intellect.” ― Oscar Wilde, The Picture of Dorian Gray I don’t get it.. 11:20:21 PM   [sourcecode language=”python”] #USAGE python brute_force.py <pdfFile> import PyPDF2, os, sys, logging logging.basicConfig(level=logging.DEBUG, format="%(asctime)s – %(levelname)s – %(message)s") […]

Coding

Python Learning: Automate Boring Stuff with Python | Chapter 13: Custom Invitations as Word Documents

“Nothing annoys people so much as not receiving invitations.” ― Oscar Wilde, The Importance of Being Earnest I know that feeling…humph.. 10:36:20 PM   [sourcecode language=”python”] #usage python invitation.py <textFile> import docx, os, sys, logging from docx.enum.text import WD_ALIGN_PARAGRAPH logging.basicConfig(level=logging.DEBUG, format="%(asctime)s – %(levelname)s – %(message)s") if len( sys.argv ) == 2: #TODO: GET TEXT FILE textFileName […]

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 12: Spreadsheet to Text Files

Chapter 12 done!!! Finally Now I can sleep.. for 10 minutes though.. 3:42:14 AM Suggestions are welcomed. [sourcecode language=”python”] #USAGE python sheet2text.py <EXCELFILE> import logging, sys, os, openpyxl logging.basicConfig(level=logging.DEBUG, format="%(asctime)s – %(levelname)s – %(message)s") if len(sys.argv) == 2: #TODO: EXTRACTS EXCEL FILE excelfile = sys.argv[1] excelfile = os.path.abspath(excelfile) excelfile_name = os.path.basename(excelfile).split(".")[0] if not os.path.exists(excelfile): logging.error("Excel File […]

Coding

Python Learning: Automate Boring Stuff with Python | Chapter 12: Spreadsheet cell Inverter

This isn’t too bad …right ? Not too tired but would rather be sleeping now. Unfortunately I have to finish this chapter before Sunday.. sighs deeply 2:53:05 AM     [sourcecode language=”python”] #USAGE python sheetinverter.py <WB> import logging, openpyxl, os,sys logging.basicConfig(level=logging.DEBUG, format="%(asctime)s – %(levelname)s – %(message)s") if len(sys.argv) == 2: #TODO: EXTRACT WB wb = sys.argv[1] wb […]