Skip to content

Python Posts

Python Print All Object Properties Cover Image

Python: Print an Object’s Attributes

Learn how to print all of a Python object’s attributes using the dir() and vars() functions, and how to print pretty using the pprint module.

Python Split a List (In Half, in Chunks) Cover Image

Python: Split a List (In Half, in Chunks)

Learn how to split a Python list into n chunks, including how to split a list into different sized sublists or a different number of sublists.

Python Flatten List of Lists Cover Image

Python: Flatten Lists of Lists (4 Ways)

Learn how to use Python to flatten a list of lists, including using the itertools library, list comprehension, and multi-level lists of lists.

Python Remove Newline Characters from String Cover Image

Python: Remove Newline Character from String

In this post, you’ll learn how to use Python to remove newline characters from strings, including how to replace all or trailing newlines.