Python Properties

Learning Python

Python is a high level programming language that has a great scope in the today’s fields. So, Python training institute having a great demand.


Python is implicitly and dynamically typed, so it is not declared as variables. The types are enforced, and the variables are also case sensitive, so var and VAR are treated as two separate variables. To know how any object work which need to type the following


Use the dir(object) command to find out all the methods of a particular option, and use object.__doc__ to find out its document string.

Python does not have mandatory characters to terminate statements. Statements expecting an indentation level end with a colon. By adding comments, use the # sign for each line. Multi-line strings need to be used for multi-line comments. Values are assigned using the “=” sign, and equality testing is done with two of them “==”. You can decrement or increment values with the operators += or -= with the amount on the right-hand side. This can work on strings and other data types.

Data types

The data structures in Python are dictionaries, tuples and lists. Sets can be found in the sets libraries that are available in all versions of Python from 2.5 onwards. Lists are similar to one-dimensional arrays. Dictionaries are essentially associative arrays, or hash tables. Tuples are one-dimensional arrays. Now, Python arrays can be of any type and types is always zero. Negative numbers start from the end to the beginning, and -1 is the last item. Variables can also point to functions.

For example use the colon to access array ranges and leave the start index as empty, the interpreter assumes the first item, so the end index assumes the last item. Negative indexes count from the last item, so -1 is seen as the last item.

In the last line, adding a third parameter will see Python step in the N item increments, instead of one. For instance, in the above sample code, the first item is returned and then the third, so items zero and two in zero-indexing.


Python strings can use single or double quotation marks, and also use quotation marks of one kind in a string using another kind, so the following is valid:

“This is a ‘valid’ string”

Multi-strings are enclosed in single or triple double quotes. Python can support Unicode right from the start, using the following syntax:

u”This is Unicode”

To fill strings with values, use the modulo (%) operator and then a tuple. Each % gets replaced with a tuple item from left to right, and you can use dictionary substitutions as well.

>>>print “Name: %s\

Number: %s\

String: %s” % (, 3, 3 * “-“)

Name: Poromenos

Number: 3

String: —


strString = “””This is

a multiline


>>> print “This %(verb)s a %(noun)s.” % {“noun”: “test”, “verb”: “is”}

This is a test.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s