43 guides
Python How-To Guides
Direct answers to the most-searched Python questions. Every guide leads with a copy-paste-runnable snippet, then a plain-language explanation and a few variations you might actually need.
Basics
Data
Dates
Dicts
Files
Lists
- How to reverse a list in Python
- How to sort a list in Python
- How to remove duplicates from a list in Python
- How to convert a list to a string in Python
- How to count occurrences in a list in Python
- How to check if an item is in a list in Python
- How to sum a list in Python
- How to iterate a list in Python
- How to flatten a list in Python
- How to get max and min of a list in Python
- How to get the length of a list in Python
- How to find the index of an item in a list in Python
- How to copy a list in Python
- How to convert a list to a tuple in Python
- How to convert a tuple to a list in Python
Strings
- How to convert a string to an int in Python
- How to replace a substring in Python
- How to check if a string contains a substring in Python
- How to split a string in Python
- How to format a string in Python
- How to concatenate strings in Python
- How to convert an int to a string in Python
- How to strip whitespace from a string in Python