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
Read a text file with Python.
python
read text file
Scrape a Wikipedia page.
python
requests
scrape
bs4
Choose the best string formatting: % vs. .format vs. f-string literal.
'.format'
string formatting
f-string
'%'
Flush the output of the print function.
python
print
output
flush
Prettyprint a JSON file.
python
prettyprint
json file
Create a dictionary with list comprehension.
python
dictionary
list comprehension
Reverse a string.
python
string
reverse
Convert two lists into a dictionary.
python
convert
list-to-dictonary
Convert an integer into a string.
python
convert
integer-to-string
Generate random strings with upper case letters and digits.
python
random
string-uppercase
generate
Extract extension from filename.
python
filenames
file-extension
Print to stderr in Python.
python
stderr
printing
zen-of-python
Generate random integers between 0 and 9.
python
random
integer
Measure elapsed time in Python.
python
time
measure
Read from stdin (standard input).
python
stdin
read
Get the class name of an instance.
python
class name
instance
Check if a string is empty.
python
string
check
empty
Pad zeroes to a string.
python
string
pad zeros
Delete an element from a dictionary.
python
dictionary
delete element
Check if a string is a float.
python
check type
float
Count the occurrences of an item in a list.
python
list
count
Remove a trailing newline.
python
newline
trailing
Print literal curly-brace characters in a string and also use .format on it.
python
string
format
curly-braces
string-formatting
Determine the type of an object.
python
list
types
tuple
str
dict
int
Limit floats to two decimal points.
python
floating-point
rounding
precision
Know if an object has an attribute.
python
attributes
object
Select an item from a list randomly.
python
list
random
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
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
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
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
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 if __name__ == "__main__" in Python?
python
__main__
__name__==
Go to Top