Sign in

teachmepython.bsky.social

@teachmepython.bsky.social
287 followers 132 following 759 posts
PostsRepliesMedia
teachmepython.bsky.social @teachmepython.bsky.social · 8h
How to download a file with #Python using the requests package:
000
teachmepython.bsky.social @teachmepython.bsky.social · 10h
Who's still using black? If you don't know what I'm talking about, black is a #Python code formatter
000
teachmepython.bsky.social @teachmepython.bsky.social · 29/09/2026
Here's a silly #Python trick that will print out the contents of the current Python file:
000
teachmepython.bsky.social @teachmepython.bsky.social · 29/09/2026
How to use a lambda to help sort named tuples in #Python in different ways 🐍🔥
011
teachmepython.bsky.social @teachmepython.bsky.social · 28/09/2026
How to add artificial delays to your #Python code using the `time` module 🐍⏰
020
teachmepython.bsky.social @teachmepython.bsky.social · 28/09/2026
How to use a #Python lambda as a return value from a function
000
teachmepython.bsky.social @teachmepython.bsky.social · 28/09/2026
How to create a thumbnail image from any photo using #Python and Pillow! And you only need FOUR lines of code! 🐍🔥
010
teachmepython.bsky.social @teachmepython.bsky.social · 22/09/2026
How to swap two variables in #Python
120
teachmepython.bsky.social @teachmepython.bsky.social · 21/09/2026
Need to run a command on a remote machine with #Python? The fabric package makes it easy! 🐍👕 Here's an example:
010
teachmepython.bsky.social @teachmepython.bsky.social · 21/09/2026
How to import a #Python module using the module's file location and importlib
000
teachmepython.bsky.social @teachmepython.bsky.social · 15/09/2026
Need to get a Windows application's version number? Here's an old example that shows how to do it with #Python
000
teachmepython.bsky.social @teachmepython.bsky.social · 15/09/2026
How to download a file over FTP with #Python using ftplib
010
teachmepython.bsky.social @teachmepython.bsky.social · 09/09/2026
Need to time small #Python snippets? Try the `timeit` module!
000
teachmepython.bsky.social @teachmepython.bsky.social · 09/09/2026
Do you use regular expressions in #Python? If not, here's a simple example to get you started:
110
teachmepython.bsky.social @teachmepython.bsky.social · 09/09/2026
How to use a lock with #Python's multiprocessing module
000
teachmepython.bsky.social @teachmepython.bsky.social · 01/09/2026
How to use a #Python lambda with the `map()` function to triple each number in a sequence returned from `range()`
000
teachmepython.bsky.social @teachmepython.bsky.social · 31/08/2026
Have you tried the fabric package for #Python? You can use Fabric to connect to a remote machine and run commands on it. Here's an example where I ran a docker command:
021
teachmepython.bsky.social @teachmepython.bsky.social · 31/08/2026
Need to test is a sequence is populated with Truthy values in #Python? Try using the built-in `all()` function:
000
teachmepython.bsky.social @teachmepython.bsky.social · 27/08/2026
The latest episode of The Python Show Podcast is out now. In this episode, I have special guest, Tim Hopper, author of the Python Developer Tooling Handbook. We chat about #Python, tooling in Python, AI, book writing, and lots more!
100
teachmepython.bsky.social @teachmepython.bsky.social · 26/08/2026
Two methods to find the most common number in a list with #Python 🐍🔥
010
teachmepython.bsky.social @teachmepython.bsky.social · 26/08/2026
One way to sort a #Python dictionary by value:
000
teachmepython.bsky.social @teachmepython.bsky.social · 25/08/2026
Which #Python charting library do you use? 🐍matplotlib 🐍xy 🐍seaborn 🐍plotly 🐍bokeh 🐍altair 🐍plotnine 🐍pygal Or something else?
020
teachmepython.bsky.social @teachmepython.bsky.social · 19/08/2026
How to use a lock with #Python's multiprocessing module:
000
teachmepython.bsky.social @teachmepython.bsky.social · 18/08/2026
Have you ever created a ternary expression in #Python? A ternary is a one-line conditional statement. Check it out:
000
teachmepython.bsky.social @teachmepython.bsky.social · 17/08/2026
Did you know you can do function overloading in #Python with `functools`? Here's an example:
110
teachmepython.bsky.social @teachmepython.bsky.social · 16/08/2026
How to create a simple thread pool in #Python 🐍🕸
000
teachmepython.bsky.social @teachmepython.bsky.social · 15/08/2026
#Python Pop Quiz 🐍❓ What is the output of the following code? A) An exception is raised B) x=... C) x=Ellipsis D) Something else
000
teachmepython.bsky.social @teachmepython.bsky.social · 14/08/2026
How to reverse a string and a list in #Python using the same code!
000
teachmepython.bsky.social @teachmepython.bsky.social · 12/08/2026
PyPI exceeded 2 EXABYTES in bandwidth served in 2026 so far! That'scrazy!
000
teachmepython.bsky.social @teachmepython.bsky.social · 11/08/2026
Did you know you can add an `else` statement to a `while` loop in #Python? If so, what do you use it for? If not, here's an example:
110
teachmepython.bsky.social @teachmepython.bsky.social · 11/08/2026
Have you ever used a generator expression in #Python? If so, what did you use it for?
111
teachmepython.bsky.social @teachmepython.bsky.social · 10/08/2026
Pyrefly, a super fast #Python type checker, dropped version 1.2 last week This release includes: 🐍 New support for Bazel  🐍 New support for attrs 🐍 The type checker coverage tool is now stable 🐍 and more!
110
teachmepython.bsky.social @teachmepython.bsky.social · 10/08/2026
Want to know how many cores on your CPU with #Python? You can use the multiprocessing module for that 🐍🔥
000
teachmepython.bsky.social @teachmepython.bsky.social · 07/08/2026
My friend, Adam Johnson, has released a new versio nf of time-machine, a library for mocking the current date and time in Python tests New features: 🐍 Python 3.15 support 🐍 Faster patched functions 🐍 Subinterpreter support 🐍 Built-in freezegun migration
100
teachmepython.bsky.social @teachmepython.bsky.social · 07/08/2026
Django 6.1 is out now! New features include: 🐍Database level delete options for ForeignKey 🐍Dictionary based email settings 🐍Support for Python 3.12-3.14 🐍Model field fetch modes and more!
100
teachmepython.bsky.social @teachmepython.bsky.social · 04/08/2026
Did you know you can read a text file in #Python using pathlib? Here's how to do it:
000
teachmepython.bsky.social @teachmepython.bsky.social · 30/07/2026
collections.ChainMap is a built-in Python class that groups multiple dictionaries or mappings into a single, updatable view. Instead of merging dictionaries and creating new data structures in memory, it links them by reference so you can search and manage them as one
000
teachmepython.bsky.social @teachmepython.bsky.social · 29/07/2026
Have you ever used #Python's deque collection before? A deque is designed specifically for fast, memory-efficient, and thread-safe additions and removals from both ends You can even rotate a deque! Here are some examples:
000
teachmepython.bsky.social @teachmepython.bsky.social · 29/07/2026
Have you ever used the psutil package? It's a great #Python package for getting information about your computer's hardware, and it's cross-platform! Here's an example of getting your RAM:
000
teachmepython.bsky.social @teachmepython.bsky.social · 28/07/2026
Have you tried out the `collections` module in #Python? I really like it. One of my favorite parts of collections if `Counter` which gives you an easy way to take in an iterable and find the most common values within it
010
teachmepython.bsky.social @teachmepython.bsky.social · 28/07/2026
How to zip two uneven lists together in #Python 🐍🤐
010
teachmepython.bsky.social @teachmepython.bsky.social · 27/07/2026
The latest version of Ruff came out last week. Ruff is a rust-base #Python linter and formatter that is super fast! With v0.16.0, Ruff enables 413 rules by default, up from 59 in previous versions.
110
teachmepython.bsky.social @teachmepython.bsky.social · 27/07/2026
How to find the edges of objects in a photo with #Python and skimag
001
teachmepython.bsky.social @teachmepython.bsky.social · 24/07/2026
The EuroPython keynote with Guido van Rossum (creator of #Python) and Pablo Galindo Salgado and Łukasz Langa (core developers) is up now on YouTube. 🐍🔥 This looks like a fun one!
110
teachmepython.bsky.social @teachmepython.bsky.social · 24/07/2026
How to invert the colors of an image with #Python and Pillow with FOUR lines of code 🐍🔥
010
teachmepython.bsky.social @teachmepython.bsky.social · 23/07/2026
Want to run a #Python script without needing to install Python? Try the new taipan package! Taipan creates a single self-contained binary (Zig + embedded CPython) that runs PEP 723 scripts on machines with no Python installed.
100
teachmepython.bsky.social @teachmepython.bsky.social · 23/07/2026
My friend, Adam Johnson, released a project called django-crawl The django-crawl project will crawl your #Django website and find errors like broken links, exceptions, etc
110
teachmepython.bsky.social @teachmepython.bsky.social · 22/07/2026
What do you think of the proposal to add d-strings to #Python in 3.16? A d-string will automatically remove indentation from multiline string literals Example from PEP 822
110
teachmepython.bsky.social @teachmepython.bsky.social · 21/07/2026
The latest edition of the Python Papers Newsletter is out now!
110
teachmepython.bsky.social @teachmepython.bsky.social · 20/07/2026
Have you ever tried out #Python's OrderedDict from the `collections` module? It offers a couple of handy special methods, like `move_to_end()` to move an item in the dict to the end of the dict:
000