Explain Codes LogoExplain Codes Logo

Python

How can I read large text files line by line, without loading them into memory?

python
best-practices
memory-management
file-io

How can I print variable and string on same line in Python?

python
functions
formatting
strings

How can I partition (split up, divide) a list based on a condition?

python
partition
list
comprehension

How can I multiply all items in a list together with Python?

python
functions
collections
best-practices

How can I map True/False to 1/0 in a Pandas DataFrame?

python
pandas
dataframe
data-type-conversion

How can I get dictionary key as variable directly in Python (not by searching from value)?

python
list-comprehension
pythonic-way
key-based-operations

How can I get a list of all classes within current module in Python?

python
functions
best-practices
collections

How can I find the current OS in Python?

python
platform-module
cross-platform-checks
os-specific-functions

How can I filter a date of a DateTimeField in Django?

python
django-orm
date-filtering
datetime

How can I create directories recursively?

python
pathlib
filesystem
directory-creation

How can I convert JSON to CSV?

python
json
pandas
csv

How can I convert an RGB image into grayscale in Python?

python
image-processing
pillow
numpy

How can I check the extension of a file?

python
file-handling
pathlib
file-extension

How can I check if my python object is a number?

python
duck-typing
error-handling
type-checking

How are lambdas useful?

python
function-factories
functional-programming
lambda-functions

Hasnext() for Python iterators?

python
iterators
sentinel-values
custom-wrappers

Getting number of elements in an iterator in Python

python
iterator
performance
memory-optimization

Getting a list of values from a list of dicts

python
list-comprehension
memory-efficiency
data-extraction

Getting a Hidden Password Input

python
password-security
input-handling
user-experience

Get the current git hash in a Python script

python
prompt-engineering
best-practices
tools