Category: "Python"

wxPython Notes, Tips and Tricks

September 27th, 2023

SSL Certs

March 13th, 2023

Python Daemons

October 8th, 2022

Multithreading Producer and Consumer (Python)

October 8th, 2022

Resources on Producer/Consumer multithreading in Python

MULTITHREADING - PRODUCER AND CONSUMER WITH QUEUE

Python

September 2nd, 2021

Lately I've written several Python programs.  I'm going to document links to a number of general/common tasks here and try to add some degree of organization to them.

XML / BeautifulSoup4
set XML attribute value with BeautifulSoup4
How to Parse XML Files Using Python’s BeautifulSoup
Changing element value with BeautifulSoup returns empty element

RegEx
Python regex multiple search

Python SFTP
pysftp Cook Book
pysftp 0.2.9
How to check if a file exists in ftp with pysftp?
Verify host key with pysftp
PySFTP connection works but get() fails

Audio
Sound alarm when code finishes
Play a Sound with Python

Files
Copy / Move Directory - distutils.dir_util
Recursively copy an entire directory tree - shutil
Move, copy, delete and rename python files and folders
How to read a file line-by-line into a list?

Excel Files
Reading an excel file using Python openpyxl module

CSV Files
How to update rows in a CSV file

Zip Files
How to create a zip archive of a directory in Python?
Create (zip) archive using shutil

Config Files
configparser — Configuration file parser
Change value in ini file using ConfigParser Python

Command Line Arguments
Python argparse - the Perl Getopt equivalent
Argparse Tutorial

Database
Using Bind Variables
Executing a SQL Statement with bind variables on Oracle with Python
Oracle Database Connection in Python
export oracle query result set to excel sheet using python script in linux os

Oracle Pandas (dataframe)
CX_Oracle - import data from Oracle to Pandas dataframe
pandas-oracle 2.1.4
Pandas Oracle
Working with Python Pandas and XlsxWriter
Display the Pandas DataFrame in table style

Docker
Python Docker official image

Unicode / UTF8 / Language Codes
Python3 Chinese file read write method
How to auto detect text file encoding?
Character detection in a text file in Python using the Universal Encoding Detector (chardet)
python utf-8-sig BOM in the middle of the file when appending to the end
Unicode (UTF-8) reading and writing to files in Python
UnicodeDecodeError: 'charmap' codec can't decode byte X in position Y: character maps to <undefined>
UnicodeDecodeError: 'utf8' codec can't decode byte 0x9c
Unicode HOWTO

Strings
string — Common string operations
Python: Check if String Contains Substring
Converting from a string to boolean in Python?
Remove all special characters, punctuation and spaces from string

Tk/tkinter
Visual TK

General
Create object from class in separate file
Yes/No prompt in Python3 using strtobool
How to convert a file into a dictionary?
Python Dictionary – Create, Append, Update, Remove
What does a b prefix before a python string mean?
What does the if __name__ == “__main__”: do?
Understanding if __name__ == “__main__” in Python
How to print without newline or space?
How to install packages using pip through corporate proxy with configuration script?
How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31
Extract file name from path, no matter what the os/path format
How to Do Ternary Operator Assignment in Python
Ignore KeyError and continue program
Switch Case in Python (Replacement)
Check if a large file exists without downloading it
Handling Exceptions