Google's Python Class 笔记(Python Set Up)
Python入门的书并没有多少,但其实python也不需要特别像学习C语言一样一板一眼的学,完全可以通过写小程序或者看一些速成的教程(前提是你已经有了程序设计基础)学。我是通过Google Python Class进行学习,在这里记录一下学习笔记。
====================================================================================
Environment Ubuntu12.04 LTS 32-bit
Author:majie
Google Python class:https://code.google.com/edu/languages/google-python-class/
2012-05-12 21:21:52
====================================================================================
Python Set Up
a. Download python, you could use the
sudo apt-get install apt-get install python
and python -V to show the version of your python
For example, mine is Python 2.7.3
b. Download google-python-exercises.zip (https://code.google.com/edu/languages/google-python-class/google-python-exercises.zip). This is an exercises of python from google.
c. Unzip this file, and cd to the dictionary. Then
~/google-python-exercises$ python hello.py majie
Hello majie
If this could work, your python has been installed correctly.
Also we can make hello.py as a py program.
chmod +x hello.py
Then
./hello.py majie
hello majie
d. To edit python document, we need some software. I prefer Geany. It is a good text editor.Home page is here:
or use apt-get
sudo add-apt-repository ppa:geany-dev/ppa sudo apt-get update sudo apt-get install geany geany-plugins
Then, Configure auto spell check.
Tools->Plugin Manager->spell check->reference open check spelling while typing
Spell check will help you a lot when you are coding.
e. About the style of python:
Giving Google's opinion about this:
One of the advantages of Python is that it makes it easy to type a little code and quickly see what it does. In class, we want a work setup that matches that .. a text text editor working on the current file.py, and a separate command line window where you can just hit the up-arrow key to run file.py and see what it does. (Teaching philosophy aside: the interpreter is great for little experiments, as shown throughout the lectures. However, the exercises are structured as Python files that students edit. Since being able to write Python programs is the ultimate goal, I felt it was best to be in that mode the whole time, using the interpreter just for little experiments.