Sign in

teachmepython.bsky.social

@teachmepython.bsky.social
288 followers 132 following 761 posts
PostsRepliesMedia
teachmepython.bsky.social @teachmepython.bsky.social · 01/10/2026
How to plot a sine wave with #Python and the bokeh package 🐍📈
020
teachmepython.bsky.social @teachmepython.bsky.social · 01/10/2026
How to add an attachment and send it via email with #Python 🐍💌
010
teachmepython.bsky.social @teachmepython.bsky.social · 30/09/2026
How to download a file with #Python using the requests package:
000
teachmepython.bsky.social @teachmepython.bsky.social · 30/09/2026
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 · 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 · 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
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 · 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
How to find the edges of objects in a photo with #Python and skimag
001
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 · 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
teachmepython.bsky.social @teachmepython.bsky.social · 18/07/2026
If you prefer #Python, as I do, you can make your call look like this:
130
teachmepython.bsky.social @teachmepython.bsky.social · 18/07/2026
Run ZooData with a simple API call and only pay per call, NOT per seat Here's an example:
110
teachmepython.bsky.social @teachmepython.bsky.social · 17/07/2026
Do you have trouble creating fake data for your #Python tests? Then you should try the faker package! It makes creating fake data easy
100
teachmepython.bsky.social @teachmepython.bsky.social · 17/07/2026
Need to get some version information with pandas? Try the `show_versions()` method! #Python You'll get lots of great information:
000
teachmepython.bsky.social @teachmepython.bsky.social · 15/07/2026
How to make your #Python code play a sound (assuming your system supports the system bell) 🐍🔔
000
teachmepython.bsky.social @teachmepython.bsky.social · 15/07/2026
How to concatenate two PDFs with #Python and pdfrw2
000
teachmepython.bsky.social @teachmepython.bsky.social · 15/07/2026
Need to figure out the memory usage of each column in a pandas DataFrame? There's a method for that: 🐼🐍🔥
000