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

https://github.com/jeffthompson/pythonteachingexamples

Example scripts for learning Python
https://github.com/jeffthompson/pythonteachingexamples

Last synced: 10 months ago
JSON representation

Example scripts for learning Python

Awesome Lists containing this project

README

          

PythonTeachingExamples
======================

Example scripts for learning Python. Currently examples are for text parsing for data visualization.

**GETTING STARTED**
We'll be writing code in a text editor - I recommend one of the following:
+ Text Wrangler (free, [download here](http://www.barebones.com/products/textwrangler/download.html))
+ Sublime Text (free with paid upgrade, [download here](http://www.sublimetext.com/2))

Python is a scripting language that is very powerful, but easy to get started with. It should come pre-installed on your computer! To check, open your command line:
+ Mac users: `Applications > Utilities > Terminal`
+ PC users: `Start > All Programs > Accessories > Command Prompt`

To see if Python is set up, type `python` into the window - you should get a bunch of information on which version you have set up.

**WRITING YOUR FIRST SCRIPT**
All Python scripts (programs) will be written in your text editor and saved with the `.py` extension. See the `Basics` folder for some simple examples.

Once written, you can run your script using the following:
+ Text Wrangler: `#! > Run in Terminal...`
+ Sublime Text: `Tools > Build... (or command/control B)`

Your script should run, either in the Terminal window (Text Wrangler) or in the built-in console (Sublime Text).

**BASICS**
Just a few simple scripts to get you started. Covers printing, data types, and basic math operators.

**DATA CLEANUP**
A few examples of taking messy, real-world data and prepping it for use. (See also the `Text Processing > Introduction to Regular Expressions` example.)

**TEXT PARSING**
Basic to intermediate examples on manipulating text.

**UTILITIES**
Random assortment of (hopefully) useful scripts, mostly based on in-the-moment student questions.

\- \- \-

\[ all code available under [Creative Commons BY-NC-SA license](http://creativecommons.org/licenses/by-nc-sa/3.0/) - feel free to use but [please let me know](http://www.jeffreythompson.org) \]