This is intended to be a collection of exercises, sample programs, and links to help programmers who know Java, C, C++, or some some similar language get started programming in Python.
If you don’t have Python installed already, try these brief installation instructions.
Read and experiment with these programs to learn some of the basics.
Arithmetic, strings, conditionals, while loops, and boolean expressions.
Lists and tuples.
Using command-line arguments.
File I/O, command-line arguments, and exceptions.
Dictionaries (a.k.a. associative arrays, hash tables, etc.).
More advanced samples
Traversing a directory tree.
Using the urllib.request module to retrieve a web page.
A few simple examples using regular expressions and the re module.
- Python Documentation Homepage
- PEP 8 — Style Guide for Python Code
- PEP 257 — Docstring Conventions
- Library reference
- Built-in types