/python-cheatsheet

Basic Cheat Sheet for Python (PDF, Markdown and Jupyter Notebook)

Primary LanguageVueMIT LicenseMIT

Python Cheatsheet

Netlify Status

This Python Cheatsheet is based on the book Automate the Boring Stuff with Python and many other sources.

Anyone can forget how to make character classes for a regex, slice a list or do a for loop. This Python cheatsheet tries to provide basic reference for beginner and advanced developers, lower the entry barrier for newcomers and help veterans refresh the old tricks.

Table of Content

Cheatsheet Modules
Python Basics Datetime Module
Built-in Functions Itertools Module
Control Flow Json Module
Functions Random Module
Lists and Tuples Os Module
Dictionaries Pathlib Module
Sets
Comprehensions
Manipulating Strings
String Formatting
Regular Expressions
File and directory Paths
Reading and Writing Files
JSON and YAML
Exception Handling
Debugging
Args and Kwargs
Context Manager
__main__
setup.py
Dataclasses
Virtual Environment

Contribute

All contributions are welcome!

Running the project locally

  1. Install pnpm package manager.

    Linux/macOS

    curl -fsSL https://get.pnpm.io/install.sh | sh -
    

    On Windows (PowerShell)

    iwr https://get.pnpm.io/install.ps1 -useb | iex
    
  2. Clone the project, change to the next branch and install the dependencies.

    git clone https://github.com/wilfredinni/python-cheatsheet.git
    cd python-cheatsheet
    git checkout next
    pnpm install
    
  3. Create a new branch from next.

    git branch fix_bug
    git checkout fix_bug
    
  4. Change/upgrade/add the changes you want.

  5. Update the README if needed.

  6. Add, commit and push your changes to Github.

    git add .
    git commit -m 'Add succinct explanation of what changed'
    git push origin fix_bug
    
  7. Open a pull request.

Code of Conduct

This project and everyone who participates in it is governed by the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to services@github.com.