OK python gurus!
Fredrik Lundh
fredrik at pythonware.com
Tue Jul 13 12:16:52 EDT 1999
K Kal <k_kal at my-deja.com> wrote:
> I'm new to python. Where should I get started? Any good
> references on-line. Tutorials/sample code would be appreciated.
from the "posting guidelines" document that was
posted earlier today:
...
>From the Python FAQ:
"Python is an interpreted, interactive, object-oriented programming
language. It incorporates modules, exceptions, dynamic typing, very high
level dynamic data types, and classes. Python combines remarkable power
with very clear syntax. It has interfaces to many system calls and
libraries, as well as to various window systems, and is extensible in C or
C++. It is also usable as an extension language for applications that need
a programmable interface. Finally, Python is portable: it runs on many
brands of UNIX, on the Mac, and on PCs under MS-DOS, Windows, Windows NT,
and OS/2.
To find out more, the best thing to do is to start reading the tutorial
from the documentation set at http://www.python.org/doc/
Example: "Hello World" in Python
--------------------------------
The original task can be accomplished by a one-liner:
print "Hello World!"
Here is a longer example, a function that returns a string
containing a series of multiple "Hello World!" greetings:
def my_hello(how_often):
retval = how_often * "Hello World! " # "multiply" string
return retval[:-1] # strip off trailing space
Usage:
>>> my_hello(5)
'Hello World! Hello World! Hello World! Hello World! Hello World!'
Note that block structure in Python is defined by indentation, rather than
block delimiters (as used in many other programming languages such as Perl,
...
More information about the Python-list
mailing list