Difference between revisions of "Python"

From CSE330 Wiki
Jump to: navigation, search
m
Line 3: Line 3:
 
Python is an interpreted language with familiar syntax. It's a great language to use for parsing text files and rapid application development. Rather than the time-consuming write-compile-test-rewrite-recompile-retest-etc. cycle of languages like C and C++, Python scripts run through an interpreter. This eliminates the compile step and speeds up the development process.
 
Python is an interpreted language with familiar syntax. It's a great language to use for parsing text files and rapid application development. Rather than the time-consuming write-compile-test-rewrite-recompile-retest-etc. cycle of languages like C and C++, Python scripts run through an interpreter. This eliminates the compile step and speeds up the development process.
  
=Using Python=
+
==Installing Python==
 +
 
 +
yum install python
 +
 
 +
should do the trick.
 +
 
 +
==Using Python==
 +
 
 +
Python programs can be run in several ways. Two of the most common ways are through the python shell and in .py files.
 +
To enter the python shell, simply type
 +
python
 +
into your shell. Interactive mode should start up, and you can type commands to be directly executed. You can exit interactive mode with ctrl+d or with
 +
quit()
 +
To run a .py file, simply use:
 +
 
 +
python <filename> <args>
 +
 
 +
==Syntax==
 +
 
 +
Since the online documentation for Python is quite extensive and helpful, [http://docs.python.org/tutorial/index.html the online Python tutorial] is definitely the place to start. Once you understand the basics of the shell.

Revision as of 15:53, 16 July 2010

Getting Started

Python is an interpreted language with familiar syntax. It's a great language to use for parsing text files and rapid application development. Rather than the time-consuming write-compile-test-rewrite-recompile-retest-etc. cycle of languages like C and C++, Python scripts run through an interpreter. This eliminates the compile step and speeds up the development process.

Installing Python

yum install python

should do the trick.

Using Python

Python programs can be run in several ways. Two of the most common ways are through the python shell and in .py files. To enter the python shell, simply type

python

into your shell. Interactive mode should start up, and you can type commands to be directly executed. You can exit interactive mode with ctrl+d or with

quit()

To run a .py file, simply use:

python <filename> <args>

Syntax

Since the online documentation for Python is quite extensive and helpful, the online Python tutorial is definitely the place to start. Once you understand the basics of the shell.