Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/justmarkham/python-reference

Python Quick Reference
https://github.com/justmarkham/python-reference

jupyter-notebook python quick-reference reference script

Last synced: 1 day ago
JSON representation

Python Quick Reference

Awesome Lists containing this project

README

        

## Python Quick Reference

### View as a [Python script](reference.py) or a [Jupyter notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb)

This is the reference guide to Python that I **wish** had existed when I was learning the language.

Here's what I want in a reference guide:

- **High-quality examples** that show the simplest possible usage of a given feature
- **Explanatory comments**, and descriptive variable names that eliminate the need for some comments
- Presented as a **single script (or notebook)**, so that I can keep it open and search it when needed
- **Code that can be run** from top to bottom, with the relevant objects defined nearby

This is **not** written as a full-fledged Python tutorial, though I ordered the topics such that you can read it like a tutorial (i.e., each topic depends only on material preceding it).

The guide was written using Python 2 but is **fully compatible** with Python 3. Relevant differences between Python 2 and 3 are noted throughout the guide.

### Table of Contents

Click to jump to the relevant section of the script or the notebook:

1. Imports ([script](reference.py#L28), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#1.-Imports))
2. Data Types ([script](reference.py#L52), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#2.-Data-Types))
3. Math ([script](reference.py#L84), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#3.-Math))
4. Comparisons and Boolean Operations ([script](reference.py#L102), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#4.-Comparisons-and-Boolean-Operations))
5. Conditional Statements ([script](reference.py#L121), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#5.-Conditional-Statements))
6. Lists ([script](reference.py#L150), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#6.-Lists))
7. Tuples ([script](reference.py#L224), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#7.-Tuples))
8. Strings ([script](reference.py#L259), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#8.-Strings))
9. Dictionaries ([script](reference.py#L319), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#9.-Dictionaries))
10. Sets ([script](reference.py#L372), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#10.-Sets))
11. Defining Functions ([script](reference.py#L409), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#11.-Defining-Functions))
12. Anonymous (Lambda) Functions ([script](reference.py#L474), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#12.-Anonymous-%28Lambda%29-Functions))
13. For Loops and While Loops ([script](reference.py#L495), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#13.-For-Loops-and-While-Loops))
14. Comprehensions ([script](reference.py#L540), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#14.-Comprehensions))
15. Map and Filter ([script](reference.py#L594), [notebook](http://nbviewer.jupyter.org/github/justmarkham/python-reference/blob/master/reference.ipynb#15.-Map-and-Filter))

### Other Python Resources

If you like the general format of this guide, but need **more explanation of each topic**, I highly recommend reading the Appendix of [Python for Data Analysis](http://shop.oreilly.com/product/0636920023784.do). It presents the essentials of the Python language in a clear and focused manner.

If you are looking for a resource that will help you to **learn Python from scratch**, this is [my list of recommended resources](https://github.com/justmarkham/DAT8#python-resources).

### Suggestions or Corrections

If there's a **topic or example** you'd like me to add to this guide, or you notice a **mistake**, please [create a GitHub issue](../../issues) or [leave a blog comment](http://www.dataschool.io/python-quick-reference/).

Thank you!