HowTos
Free Video Tutorials
Written Tutorials
💲Paid Courses
Python Shell
Mailing List
About Us
Home/
Top Python How-To Questions
Choose the best string formatting: % vs. .format vs. f-string literal.
'.format'
string formatting
f-string
'%'
Extract extension from filename.
python
filenames
file-extension
Get the class name of an instance.
python
class name
instance
Use static methods.
python
static-methods
Determine the type of an object.
python
list
types
tuple
str
dict
int
Know if an object has an attribute.
python
attributes
object
Call a function of a module by using its name.
python
object
function-call
Sort a list of dictionaries by a value of the dictionary.
python
list
dictionary
sorting
data-structures
Rename column names with Pandas.
python
dataframe
pandas replace
rename
Find current directory of a file.
python
directory
file-directory
Use the super() with __init__() methods.
oop
super
inheritance
python class
Iterate over rows in a DataFrame for Pandas.
python
pandas
dataframe
List all files of a directory.
python
directory
list files
Safely create a nested directory.
python
directory
exception
operating-system
path
Create a pandas DataFrame from a list.
python
pandas
dataframe from list
Create a class.
python
create a class
define a class
class definition
Create a flask app.
create
app
flask
render template
html flask
python.
Top Python What Questions
Why do Python classes inherit 'object'
python
inheritance
object-class
What is the meaning of single and double underscore before an object name?
python
double-underscore
single-underscore
What's the canonical way to check a type in Python?
python
canonical
check-type
What is the proper way to declare custom exceptions in modern Python?
python
custom-exeptions
declare
What can I use as a replacement for the switch statement in Python?
python
replace
switch statement
How to add an existing venv virtual environment in PyCharm
venv
pycharm
Are static class variables possible in Python?
python
oop
class-variables
static
class
What does ** (double star/asterisk) and * (star/asterisk) do for parameters?
parameter-passing
python syntax
argument-unpacking
variadic-functions
What are metaclasses in Python?
python
oop
metaclass
python-class
python-datamodel
Python Classes and OOP Explained
oop
object oriented programming
classes
What is the difference between a staticmethod and a classmethod in Python?
python
classmethod vs staticmethod
static method
instance method
class method
What is if __name__ == "__main__" in Python?
python
__main__
__name__==
Go to Top
Become a Patron
Do you like my work and would want to contribute? You can become a patron on my Patreon below!
Become a Patron