Python
All tutorials in Python
Sort By:    Name   Rating   Views  Comments    Date 
Browse Pages :    1  2  3  >  >> 
Python with other Languages
Submitted 29 April 2008

Python is often compared to other interpreted languages such as Java, JavaScript, Perl, Tcl, or Smalltalk. Comparisons to C++, Common Lisp and Scheme can also be enlightening. In this section I will briefly compare Python to each of these languages. These comparisons concentrate on language issues only. In practice, the choice of a programming language is often dictated by other real-world...

Views: 99 Comments: 0
Python Issues and some Tips
Submitted 29 April 2008

There's an interface to wxWindows called wxPython. wxWindows is a portable GUI class library written in C++. It supports GTK, Motif, MS-Windows and Mac as targets. Ports to other platforms are being contemplated or have already had some work done on them. wxWindows preserves the look and feel of the underlying graphics toolkit, and there is quite a rich widget set and collection of GDI classes....

Views: 84 Comments: 0
Classes and objects - Python
Submitted 29 April 2008

Having used some of Python's built-in types, we are ready to create a user-defined type: the Point. Consider the concept of a mathematical point. In two dimensions, a point is two numbers (coordinates) that are treated collectively as a single object. In mathematical notation, points are often written in parentheses with a comma separating the coordinates. For example, (0, 0) represents the...

Views: 89 Comments: 0
Functions and Strings -Python
Submitted 29 April 2008

When known to the interpreter, the script name and additional arguments thereafter are passed to the script in the variable sys.argv, which is a list of strings. Its length is at least one; when no script and no arguments are given, sys.argv[0] is an empty string. When the script name is given as '-' (meaning standard input), sys.argv[0] is set to '-'. When -c command is used, sys.argv[0] is set...

Views: 113 Comments: 0
Conditionals and recursion - Python
Submitted 29 April 2008

he modulus operator turns out to be surprisingly useful. For example, you can check whether one number is divisible by another if x % y is zero, then x is divisible by y. Also, you can extract the right-most digit or digits from a number. For example, x % 10 yields the right-most digit of x (in base 10). Similarly x % 100yields the last two digits.

Views: 120 Comments: 0
Input and Output - Python
Submitted 29 April 2008

o far we've encountered two ways of writing values: expression statements and the print statement. (A third way is using the write() method of file objects; the standard output file can be referenced as sys.stdout.Often you'll want more control over the formatting of your output than simply printing space-separated values. There are two ways to format your output; the first way is to do all the...

Views: 113 Comments: 0
Debugging
Submitted 29 April 2008

The index you are using to access a list, string, or tuple is greater than its length minus one. Immediately before the site of the error, add a print statement to display the value of the index and the length of the array. Is the array the right size? Is the index the right value?

Views: 115 Comments: 0
History
Submitted 29 April 2008

Python is an interpreted, interactive, object-oriented programming language. Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing...

Views: 103 Comments: 0
Modules in Python
Submitted 09 May 2008

If you quit from the Python interpreter and enter it again, the definitions you have made (functions and variables) are lost. Therefore, if you want to write a somewhat longer program, you are better off using a text editor to prepare the input for the interpreter and running it with that file as input instead. This is known as creating a script. As your program gets longer, you may want to split...

Views: 7913 Comments: 0

A programmer can be significantly more productive in Python than in Java. How much more productive? The most widely accepted estimate is 5-10 times. On the basis of my own personal experience with the two languages, I agree with this estimate.

Views: 61 Comments: 0
Learn Python in 10 Minutes
Submitted 02 June 2008

So, you want to learn the Python programming language but can't find a concise and yet full-featured tutorial. This tutorial will attempt to teach you Python in 10 minutes. It's probably not so much a tutorial as it is a cross between a tutorial and a cheatsheet, so it will just show you some basic concepts to start you off. Obviously, if you want to really learn a language you need to program in...

Views: 184 Comments: 0

Defining a regular expression is to provide a sequence of characters, the pattern, that will match sequences of characters in a target.Sets of characters -- Characters and sequences of characters in square brackets form a set; a set matches any character in the set or range. For example, "[abc]" matches "a" or "b" or "c". And, for example,...

Views: 55 Comments: 0
Unit Tests
Submitted 02 June 2008

Unit test and the Python unit test framework provide a convenient way to define and run tests that ensure that a Python application produces specified results. This section, while it will not attempt to explain everything about the unit test framework, will provide examples of several straight-forward ways to construct and run tests.

Views: 53 Comments: 0
Extending and embedding Python
Submitted 02 June 2008

Extending Python means to implement an extension module or an extension type. An extension module creates a new Python module which is implemented in C/C++. From Python code, an extension module appears to be just like a module implemented in Python code. An extension type creates a new Python (built-in) type which is implemented in C/C++. From Python code, an extension type appears to be just...

Views: 37 Comments: 0
Parsing in Phyton
Submitted 02 June 2008

Python is an excellent language for text analysis.In some cases, simply splitting lines of text into words will be enough. In these cases use string.split(). In other cases, regular expressions may be able to do the parsing you need. If so, see the section on regular expressions in this document. However, in some cases, more complex analysis of input text is required. This section describes some...

Views: 64 Comments: 0
Browse Pages :    1  2  3  >  >>