Explain Codes LogoExplain Codes Logo

Python

How do I check which version of Python is running my script?

python
python-version
assertion
sys-version-info

How do I check the operating system in Python?

python
system-information
os-identification
python-modules

How do I check if a string is Unicode or ASCII?

python
functions
best-practices
collections

How do I check if a directory exists in Python?

python
pathlib
file-system
directory-existence

How can I see normal print output created during pytest run?

python
pytest
testing
debugging

How can I scrape a page with dynamic content (created by JavaScript) in Python?

python
scraping
javascript-rendering
selenium

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