Explain Codes LogoExplain Codes Logo

Python

Simple argparse example wanted: 1 argument, 3 results

python
argparse
command-line
input-validation

What do __init__ and self do in Python?

python
self
init
instance-variables

How do I sort a dictionary by key?

python
dictionary-sorting
lambda
sortedcontainers

How do I make a time delay?

python
time-delay
asyncio
selenium

Parsing boolean values with argparse

python
argparse
boolean-arguments
command-line

How can I specify the function type in my type hints?

python
type-hints
callable
protocol

Get name of current script in Python

python
script-name
pathlib
sys-argv

How do I detect whether a variable is a function?

python
function-detection
callable
introspection

Can I remove script tags with BeautifulSoup?

python
beautifulsoup
html-manipulation
script-removal

Change column type in pandas

python
pandas
dataframe
type-conversion

Can Flask have optional URL parameters?

python
flask
optional-parameters
restful

Extract file name from path, no matter what the os/path format

python
filename-extraction
pathlib
cross-platform

How to install psycopg2 with "pip" on Python?

python
psycopg2
virtualenv
installation

How do I reverse a list or loop over it backwards?

python
list-reversal
memory-management
performance

Filter dict to contain only certain keys?

python
filtering
dictionary-comprehension
lambda

Get difference between two lists with Unique Entries

python
set-operations
list-comprehension
efficiency

What is the best way to remove accents (normalize) in a Python unicode string?

python
unicode
normalization
regex

What is a cross-platform way to get the home directory?

python
pathlib
file-operations
cross-platform

Class (static) variables and methods

python
class-variables
instance-attributes
descriptor-protocol

How do you round UP a number?

python
math
rounding
numpy