HowTos
Free Video Tutorials
Written Tutorials
💲Python Courses
🛠Daily Python Projects
Python Shell
About Us
Home/
Top Python How-To Questions
Delete a directory.
python
delete directory
Delete a file.
python
delete file
Send an email from Gmail.
email
Create matplotlib graphs.
python
matplotlib
Rename a file.
python
files
Create a text file and write text on it.
python
create text file
Read a text file with Python.
python
read text file
Scrape a Wikipedia page.
python
requests
scrape
bs4
Create a simple Tkinter app.
Tkinter
gui
Add a new column to an Excel file.
pandas
Choose the best string formatting: % vs. .format vs. f-string literal.
'.format'
string formatting
f-string
'%'
Create a dictionary with list comprehension.
python
dictionary
list comprehension
Extract extension from filename.
python
filenames
file-extension
Install specific package versions with pip.
python
pip
package version
install
Read from stdin (standard input).
python
stdin
read
Install pip on macOS or OS X.
macos
install pip
os x
Check if a string is a float.
python
check type
float
Remove an element from a list by index.
python
list
indexing
Exit/deactivate a virtualenv.
python
exit
virtualenv
Determine the type of an object.
python
list
types
tuple
str
dict
int
Limit floats to two decimal points.
python
floating-point
rounding
precision
Select an item from a list randomly.
python
list
random
Read a file line-by-line into a list.
python
string
file
readlines
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
Upgrade all Python packages with pip.
python
pip
upgrade
Access environment variable values.
python
environment-variables
Print coloured text on the terminal.
python
output
terminal
ansi-colors
Find current directory of a file.
python
directory
file-directory
Top Python What Questions
How to work with database files with Python and SQLite
python
sqlite
Beginner tutorial on OOP and Classes in Python
python
oop
classes
Using Bootstrap with Flask
python
flask
bootstrap
Bootstrap beginner's tutorial
bootstrap
Working with CSV files in Python
pandas
csv
Working with Word documents with Python using DOCX library
python
word doc
What is "object-state" in Python?
object
state
How to use the Python imagehash library
imagehash
How to use the Pillow library in Python.
pillow
Here is how to build Streamlit apps in Python.
python
streamlit
Why do Python classes inherit 'object'
python
inheritance
object-class
What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv?
python
venv
virtualenv
pipenv
What ipython
pyenv
virtualenvwrapper
pyvenv
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
What to do to import files from a different folder in python
python
python-import
importerror
Why is reading lines from stdin much slower in C++ than Python?
python
readlines
c++
Is there a way to run Python on Android?
python
android
android-scripting
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 is __init__.py used for?
python
module
package
python-packaging
What are metaclasses in Python?
python
oop
metaclass
python-class
python-datamodel
Does Python have a ternary conditional operator?
python
operators
conditional-operator
ternary-operator
Python Classes and OOP Explained
oop
object oriented programming
classes
Should I use a for-loop or a list comprehension in Python?
python
list comprehension
comparing
for-loop
faster
What is the difference between a staticmethod and a classmethod in Python?
python
classmethod vs staticmethod
static method
instance method
class method
What does "yield" do in a Python function?
python
yield
generator
What is the best virtual environment for Python
python
virtual environment
venv
best
Go to Top