1. install sudo apt-get install cpython
2. Start: Enter the python. Command Prompt in the command line to >>> to start the python interpreter.
3. >>> print 'aaa' to reference a string.
A simple procedure:
Python 2.6.5 (r265: 79063, Oct 1 2012, 22:07:21)
[GCC 4.4.3] on linux2 www.2cto.com
Type "help", "copyright", "credits" or "license" for more information.
>>> MyString = 'Hello World! '
>>> Print myString
Hello World!
>>> MyString
'Hello World! '
>>> _
'Hello World! '
4. The underscore (_) has a special meaning in the interpreter, indicating the value of the last expression (in the example above)
5. The print Statement of Python can be used in combination with the string format operator (%) to implement string replacement, which is very similar to the printf () function in C:
>>> Print "% s is number % d! "% (" Python ", 1)
Python is number 1!
6. An example of redirecting an output to a log file:
>>> Logfile = open ('/home/administrator/mylog.txt', 'A ')
>>> Print> logfile, 'fatal error: invalid input! '
>>> Logfile. close ()
Use the command cat mylog.txt on another terminal to display 'fatal error :........'
7.