text:
This action might not be possible to undo. Are you sure you want to continue?
Python Tutorial Tutorialspoint.com
Python is a general purpose interpreted, interactive, object-oriented and high-level programming language. Python was created by Guido van Rossum in the late eighties and early nineties. Like Perl, Python source code is now available under the GNU General Public License (GPL). This tutorial gives an initial push to start you with Python. For more detail kindly check tutorialspoint.com/python
Python Overview:
Python is a high-level, interpreted, interactive and object oriented-scripting language.
Python Python Python Python
is is is is
Interpreted Interactive Object-Oriented Beginner's Language
Python was developed by Guido van Rossum in the late eighties and early nineties at the National Research Institute for Mathematics and Computer Science in the Netherlands. Python's feature highlights include:
Easy-to-learn Easy-to-read Easy-to-maintain A broad standard library Interactive Mode Portable Extendable Databases GUI Programming Scalable
Getting Python:
The most up-to-date and current source code, binaries, documentation, news, etc. is available at the official website of Python: Python Official Website : http://www.python.org/ You can download the Python documentation from the following site. The documentation is available in HTML, PDF, and PostScript formats. Python Documentation Website : www.python.org/doc/
First Python Program:
Interactive Mode Programming:
Tutorials Point, Simply Easy Learning
Invoking the interpreter without passing a script file as a parameter brings up the following prompt:
root# python Python 2.5 (r25:51908, Nov 6 2007, 16:54:01) [GCC 4.1.2 20070925 (Red Hat 4.1.2-27)] on linux2 Type "help", "copyright", "credits" or "license" for more info. >>>
Type the following text to the right of the Python prompt and press the Enter key:
>>> print "Hello, Python!";
This will produce following result:
Hello, Python!
Python Identifiers:
A Python identifier is a name used to identify a variable, function, class, module, or other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores, and digits (0 to 9). Python does not allow punctuation characters such as @, $, and % within identifiers. Python is a case sensitive programming language. Thus Manpower and manpower are two different identifiers in Python. Here are following identifier naming convention for Python:
Class names start with an uppercase letter and all other identifiers with a lowercase letter. Starting an identifier with a single leading underscore indicates by convention that the identifier is meant to be private. Starting an identifier with two leading underscores indicates a strongly private identifier. If the identifier also ends with two trailing underscores, the identifier is a languagedefined special name.
Reserved Words:
The following list shows the reserved words in Python. These reserved words may not be used as constant or variable or any other identifier names. Keywords contain lowercase letters only. and assert break exec finally for not or pass
Tutorials Point, Simply Easy Learning
class continue def del elif else except from global if import in is lambda print raise return try while with yield
Lines and Indentation:
One of the first caveats programmers encounter when learning Python is the fact that there are no braces to indicate blocks of code for class and function definitions or flow control. Blocks of code are denoted by line indentation, which is rigidly enforced. The number of spaces in the indentation is variable, but all statements within the block must be indented the same amount. Both blocks in this example are fine:
if True: print "True" else: print "False"
However, the second block in this example will generate an error:
if True: print "Answer" print "True" else: print "Answer" print "False"
Multi-Line Statements:
Statements in Python typically end with a new line. Python does, however, allow the use of the line continuation character (\) to denote that the line should continue. For example:
total = item_one + \ item_two + \ item_three
Statements contained within the [], {}, or () brackets do not need to use the line continuation character. For example:
Tutorials Point, Simply Easy Learning
days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']
Quotation in Python:
Python accepts single ('), double (") and triple (''' or """) quotes to denote string literals, as long as the same type of quote starts and ends the string. The triple quotes can be used to span the string across multiple lines. For example, all the following are legal:
word = 'word' sentence = "This is a sentence." paragraph = """This is a paragraph. It is made up of multiple lines and sentences."""
Comments in Python:
A hash sign (#) that is not inside a string literal begins a comment. All characters after the # and up to the physical line end are part of the comment, and the Python interpreter ignores them.
#!/usr/bin/python # First comment print "Hello, Python!"; # second comment
This will produce following result:
Hello, Python!
A comment may be on the same line after a statement or expression:
name = "Madisetti" # This is again comment
You can comment multiple lines as follows:
# # # #
This is a comment. This is a comment, too. This is a comment, too. I said that already.
Using Blank Lines:
A line containing only whitespace, possibly with a comment, is known as a blank line, and Python totally ignores it. In an interactive interpreter session, you must enter an empty physical line to terminate a multiline statement.
Multiple Statements on a Single Line:
Tutorials Point, Simply Easy Learning
The semicolon ( ; ) allows multiple statements on the single line given that neither statement starts a new code block. Here is a sample snip using the semicolon:
import sys; x = 'foo'; sys.stdout.write(x + '\n')
Multiple Statement Groups as Suites:
Groups of individual statements making up a single code block are called suites in Python. Compound or complex statements, such as if, while, def, and class, are those which require a header line and a suite. Header lines begin the statement (with the keyword) and terminate with a colon ( : ) and are followed by one or more lines which make up the suite.
if expression : suite elif expression : suite else : suite
Python - Variable Types:
Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. Based on the data type of a variable, the interpreter allocates memory and decides what can be stored in the reserved memory. Therefore, by assigning different data types to variables, you can store integers, decimals, or characters in these variables.
Assigning Values to Variables:
The operand to the left of the = operator is the name of the variable, and the operand to the right of the = operator is the value stored in the variable. For example:
counter = 100 miles = 1000.0 name = "John" print counter print miles print name
# An integer assignment # A floating point # A string
Standard Data Types:
Python has five standard data types:
Numbers String List Tuple
53e-7j Python Strings: Strings in Python are identified as a contiguous set of characters in between quotation marks.322e-36j . -32.2-E12 float complex 3.0 15. For example: var1 = 1 var2 = 10 Python supports four different numerical types: int (signed integers) long (long integers [can also be represented in octal and hexadecimal]) float (floating point real values) complex (complex numbers) Here are some examples of numbers: int 10 100 -786 080 -0490 -0x260 0x69 51924361L -0x19323L 0122L 0xDEFABCECBDAECBFBAEl 535633629843L -052318172735L -4721885298529L long 0.Tutorials Point.876j -.j 9.3+e18 -90. Example: str = 'Hello World!' print print print print print print str str[0] str[2:5] str[2:] str * 2 str + "TEST" # # # # # # Prints Prints Prints Prints Prints Prints complete string first character of the string characters starting from 3rd to 6th string starting from 3rd character string two times concatenated string 6|Page .20 -21. Simply Easy Learning Dictionary Python Numbers: Number objects are created when you assign a value to them.54e100 70.9 32.6545+0J 3e+26J 4.14j 45.
786 . 'john'] print print print print print print list # list[0] # list[1:3] # list[2:] # tinylist * 2 # list + tinylist Prints complete list Prints first element of the list Prints elements starting from 2nd to 4th Prints elements starting from 3rd element Prints list two times # Prints concatenated lists Python Tuples: A tuple is another sequence data type that is similar to the list. Unlike lists.keys() # Prints all the keys print tinydict. Simply Easy Learning Python Lists: Lists are the most versatile of Python's compound data types. 786 . 70. 'dept': 'sales'} print dict['one'] # Prints value for 'one' key print dict[2] # Prints value for 2 key print tinydict # Prints complete dictionary print tinydict. Tuples can be thought of as read-only lists.2 ] tinylist = [123. A list contains items separated by commas and enclosed within square brackets ([]). however. 70.Adds values on either side of the operator Example a + b will give 30 7|Page . 'john'. A tuple consists of a number of values separated by commas. tuple = ( 'abcd'.2 tinytuple = (123. They work like associative arrays or hashes found in Perl and consist of key-value pairs. 2. 'john') print print print print print print tuple # tuple[0] # tuple[1:3] # tuple[2:] # tinytuple * 2 # tuple + tinytuple ) Prints complete list Prints first element of the list Prints elements starting from 2nd to 4th Prints elements starting from 3rd element Prints list two times # Prints concatenated lists Python Dictionary: Python 's dictionaries are hash table type.Basic Operators: Operator + Description Addition . 'john'. 2.values() # Prints all the values Python .'code':6734. tinydict = {'name': 'john'.23. #!/usr/bin/python list = [ 'abcd'.Tutorials Point. tuples are enclosed within parentheses.23.
if values are not equal then condition becomes true. >= (a >= b) is not true. Simply Easy Learning Subtraction .Subtracts right hand operand from left hand operand a . Checks if the value of left operand is less than the value of right operand. if values are not equal then condition becomes true. <> (a <> b) is true. if yes then condition becomes true. < (a < b) is true.b will give -10 * Multiplication .0 is equal to 4.0//2. This is similar to != operator. <= (a <= b) is true. Checks if the value of left operand is less than or equal to the value of right operand. if yes then condition becomes b / a will give 2 / % b % a will give 0 ** a**b will give 10 to the power 20 // 9//2 is equal to 4 and 9. Checks if the value of left operand is greater than or equal to the value of right operand. > (a > b) is not true.0 == (a == b) is not true. Checks if the value of left operand is greater than the value of right operand. if yes then condition becomes true. if yes then condition becomes true.Tutorials Point. != (a != b) is true.The division of operands where the result is the quotient in which the digits after the decimal point are removed.Divides left hand operand by right hand operand and returns remainder Exponent . if yes then condition becomes true.Divides left hand operand by right hand operand Modulus . Checks if the value of two operands are equal or not. 8|Page .Performs exponential (power) calculation on operators Floor Division .Multiplies values on either a * b will give 200 side of the operator Division . Checks if the value of two operands are equal or not. Checks if the value of two operands are equal or not.
Performs exponential (power) calculation on operators and assign value to the left operand Floor Dividion and assigns a value.a *= c *= a is equivalent to c = c * a /= c /= a is equivalent to c = c / a %= c %= a is equivalent to c = c % a **= c **= a is equivalent to c = c ** a //= c //= a is equivalent to c = c // a & (a & b) will give 12 which is 0000 1100 | (a | b) will give 61 which is 0011 1101 ^ (a ^ b) will give 49 which is 0011 0001 ~ (~a ) will give -60 which is 1100 0011 9|Page .Tutorials Point. Binary Ones Complement Operator is c = a + b will assigne value of a + b into c += c += a is equivalent to c = c + a -= c -= a is equivalent to c = c . Binary OR Operator copies a bit if it exists in eather operand. Simply Easy Learning true. It takes modulus using two operands and assign the result to left operand Exponent AND assignment operator. It multiplies right operand with the left operand and assign the result to left operand Divide AND assignment operator. = Simple assignment operator. It adds right operand to the left operand and assign the result to left operand Subtract AND assignment operator. Assigns values from right side operands to left side operand Add AND assignment operator. It divides left operand with the right operand and assign the result to left operand Modulus AND assignment operator. Performs floor division on operators and assign value to the left operand Binary AND Operator copies a bit to the result if it exists in both operands. Binary XOR Operator copies the bit if it is set in one operand but not both. It subtracts right operand from the left operand and assign the result to left operand Multiply AND assignment operator.
If both the operands are true then then condition becomes true. a << 2 will give 240 which is 1111 0000 >> a >> 2 will give 15 which is 0000 1111 and (a and b) is true. Use to reverses the logical state of its operand. here is not results in 1 if id(x) is not equal to id(y). If any of the two operands are non zero then then condition becomes true. Operator Description 10 | P a g e . not in x not in y. here not in results in a 1 if x is a member of sequence y.Tutorials Point. << Binary Left Shift Operator. not not(a && b) is false. Simply Easy Learning unary and has the efect of 'flipping' bits. Binary Right Shift Operator. Called Logical OR Operator. The left operands value is moved left by the number of bits specified by the right operand. The left operands value is moved right by the number of bits specified by the right operand. Evaluates to false if the variables on either side of the operator point to the same object and true otherwise. or (a or b) is true. Evaluates to true if the variables on either side of the operator point to the same object and false otherwise. here is results in 1 if id(x) equals id(y). is x is y. Python Operators Precedence The following table lists all operators from highest precedence to lowest. in x in y. Called Logical NOT Operator. Evaluates to true if it finds a variable in the specified sequence and false otherwise. here in results in a 1 if x is a member of sequence y. is not x is not y. Called Logical AND operator. If a condition is true then Logical NOT operator will make false. Evaluates to true if it finds a variable in the specified sequence and false otherwise.
Simply Easy Learning ** ~+Exponentiation (raise to the power) Ccomplement.. modulo and floor division Addition and subtraction Right and left bitwise shift Bitwise 'AND' Bitwise exclusive `OR' and regular `OR' Comparison operators Equality operators Assignment operators * / % // +>> << & ^| <= < > >= <> == != = %= /= //= -= += |= &= >>= <<= *= **= is is not in not in note or and Identity operators Membership operators Logical operators The if statement: The syntax of the if statement is: if expression: statement(s) The else Statement: The syntax of the if.else statement is: if expression: statement(s) else: statement(s) The elif Statement 11 | P a g e . unary plus and minus (method names for the last two are +@ and -@) Multiply.Tutorials Point.. divide.
Such a loop is called an infinite loop..elif statement is: if expression1: statement(s) elif expression2: statement(s) elif expression3: statement(s) else: statement(s) This will produce following result: 3 .else construct may be: if expression1: statement(s) if expression2: statement(s) elif expression3: statement(s) else statement(s) elif expression4: statement(s) else: statement(s) The while Loop: The syntax of the while look is: while expression: statement(s) The Infinite Loops: You must use caution when using while loops because of the possibility that this condition never resolves to a false value.elif.Tutorials Point.Got a true expression value 100 Good bye! The Nested if.else Construct The syntax of the nested if... An infinite loop might be useful in client/server programming where the server needs to run continuously so that client programs can communicate with it as and when required.elif.. This results in a loop that never ends. Single Statement Suites: 12 | P a g e .... Simply Easy Learning The syntax of the if....
The break statement can be used in both while and for loops. just like the traditional break found in C. The most common use for break is when some external condition is triggered requiring a hasty exit from a loop. var var = var -1 if var == 5: break print "Good bye!" The continue Statement: The continue statement in Python returns the control to the beginning of the while loop. The continue statement rejects all the remaining statements in the current iteration of the loop and moves the control back to the top of the loop. for letter in 'Python': # First Example if letter == 'h': break print 'Current Letter :'. fruits[index] print "Good bye!" The break Statement: The break statement in Python terminates the current loop and resumes execution at the next statement. The continue statement can be used in both while and for loops. letter var = 10 # Second Example while var > 0: print 'Current variable value :'. it may be placed on the same line as the while header. 'apple'.Tutorials Point. Simply Easy Learning Similar to the if statement syntax. Here is an example of a one-line while clause: while expression : statement The for Loop: The syntax of the loop look is: for iterating_var in sequence: statements(s) Iterating by Sequence Index: An alternative way of iterating through each item is by index offset into the sequence itself: fruits = ['banana'. 'mango'] for index in range(len(fruits)): print 'Current fruit :'. if your while clause consists only of a single statement. 13 | P a g e .
The code block within every function starts with a colon (:) and is indented. The pass Statement: The pass statement in Python is used when a statement is required syntactically but you do not want any command or code to execute. letter print "Good bye!" Defining a Function You can define functions to provide the required functionality. letter var = 10 # Second Example while var > 0: print 'Current variable value :'.. If the else statement is used with a for loop. The pass statement is a null operation. 14 | P a g e .g. but has not been written yet (e. the else statement is executed when the condition becomes false. The first statement of a function can be an optional statement . Any input parameters or arguments should be placed within these parentheses. the else statement is executed when the loop has exhausted iterating the list. You can also define parameters inside these parentheses. If the else statement is used with a while loop. Here are simple rules to define a function in Python: Function blocks begin with the keyword def followed by the function name and parentheses ( ( ) ). in stubs for example): #!/usr/bin/python for letter in 'Python': if letter == 'h': pass print 'This is pass block' print 'Current Letter :'.the documentation string of the function or docstring. Simply Easy Learning for letter in 'Python': # First Example if letter == 'h': continue print 'Current Letter :'.Tutorials Point. nothing happens when it executes. var var = var -1 if var == 5: continue print "Good bye!" The else Statement Used with Loops Python supports to have an else statement associated with a loop statements. The pass is also useful in places where your code will eventually go.
and structures the blocks of code. # Now you can call printme function printme("I'm first call to user defined function!"). Example: Here is the simplest form of a Python function. you can execute it by calling it from another function or directly from the Python prompt. Syntax: def functionname( parameters ): "function_docstring" function_suite return [expression] By default. parameters have a positional behavior.Modules: 15 | P a g e . specifies the parameters that are to be included in the function. This function takes a string as input parameter and prints it on standard screen. and you need to inform them in the same order that they were defined. Following is the example to call printme() function: #!/usr/bin/python # Function definition is here def printme( str ): "This prints a passed string into this function" print str. This would produce following result: I'm first call to user defined function! Again second call to the same function Python . printme("Again second call to the same function"). A return statement with no arguments is the same as return None. return.Tutorials Point. Simply Easy Learning The statement return [expression] exits a function. Once the basic structure of a function is finalized. def printme( str ): "This prints a passed string into this function" print str return Calling a Function Defining a function only gives it a name. optionally passing back an expression to the caller.
Tutorials Point. Opening and Closing Files: The open Function: 16 | P a g e .. A module is a Python object with arbitrarily named attributes that you can bind and reference. module2[. Simply Easy Learning A module allows you to logically organize your Python code. Example: The Python code for a module named aname normally resides in a file named aname.. A module can define functions. par return The import Statement: You can use any Python source file as a module by executing an import statement in some other Python source file. Grouping related code into a module makes the code easier to understand and use.py def print_func( par ): print "Hello : ".print_func("Zara") This would produce following result: Hello : Zara A module is loaded only once. This prevents the module execution from happening over and over again if multiple imports occur. you need to put the following command at the top of the script: #!/usr/bin/python # Import module hello import hello # Now you can call defined function that module as follows hellp. and variables. Example: To import the module hello. import has the following syntax: import module1[. moduleN] When the interpreter encounters an import statement. Simply.py. a module is a file consisting of Python code. regardless of the number of times it is imported. hello. classes.. A module can also include runnable code.py. it imports the module if the module is present in the search path. Asearch path is a list of directories that the interpreter searches before importing a module. Here's an example of a simple module.
The file pointer will be at the beginning of the file. buffering]) Here is paramters detail: file_name: The file_name argument is a string value that contains the name of the file that you want to access.Tutorials Point. This is optional parameter and the default file access mode is read (r) buffering: If the buffering value is set to 0. If you specify the buffering value as an integer greater than 1. If the file does not exist. no buffering will take place. This is optional paramter. you have to open it using Python's built-in open() function. creates a new file for reading and writing. creates a new file for reading and writing. That is. If the file does not exist. Overwrites the file if the file exists. The file pointer is placed at the beginning of the file. write append etc. Simply Easy Learning Before you can read or write a file. Opens a file for writing only in binary format. access_mode: The access_mode determines the mode in which the file has to be opened ie. The file pointer is at the end of the file if the file exists. Syntax: file object = open(file_name [. If the file does not exist. Overwrites the file if the file exists. Opens a file for both reading and writing. This function creates a file object which would be utilized to call other support methods associated with it. Overwrites the existing file if the file exists. This is the default mode. The file pointer will be at the beginning of the file. Opens a file for both writing and reading in binary format. line buffering will be performed while accessing a file. If the buffering value is 1. Opens a file for both writing and reading. Opens a file for appending. creates a new file for writing. read. access_mode][. This is the default mode. If the file does not exist. Opens a file for reading only in binary format. A complete list of possible values is given below in the table. Overwrites the existing file if the file exists. creates a new file for writing. If the file does not exist. the file is in the append mode. it creates a new file for rb r+ rb+ w wb w+ wb+ a 17 | P a g e . Opens a file for writing only. Here is a list of the different modes of opening a file: Modes r Description Opens a file for reading only. then buffering action will be performed with the indicated buffer size. Opens a file for both reading and writing in binary format. The file pointer is placed at the beginning of the file.
That is.softspace Description Returns true if file is closed. fileObject. Here is a list of all attributes related to file object: Attribute file. The file opens in the append mode. The file pointer is at the end of the file if the file exists. a+ ab+ The file object atrributes: Once a file is opened and you have one file object.Tutorials Point.closed file. the file is in the append mode. The file pointer is at the end of the file if the file exists. it creates a new file for writing. If the file does not exist. false otherwise.close(). The file pointer is at the end of the file if the file exists. The file opens in the append mode. The read() Method: Syntax: 18 | P a g e . after which no more writing can be done. Simply Easy Learning writing. If the file does not exist. Returns name of the file. The close() Method: The close() method of a file object flushes any unwritten information and closes the file object. you can get various information related to that file.write(string).name file. Returns access mode with which file was opened. Opens a file for both appending and reading in binary format. Reading and Writing Files: The write() Method: Syntax: fileObject. it creates a new file for reading and writing.mode file. ab Opens a file for appending in binary format. it creates a new file for reading and writing. true otherwise. Opens a file for both appending and reading. Returns false if space explicitly required with print. If the file does not exist.
from]) method changes the current file position. Syntax: os. the next read or write will occur at that many bytes from the beginning of the file: The seek(offset[. which is the name of the directory that you want to make the current directory. Syntax: os.delete(file_name) Directories in Python: The mkdir() Method: You can use the mkdir() method of the os module to create directories in the current directory. The chdir() method takes an argument. Renaming and Deleting Files: Syntax: os.rename(current_file_name. Syntax: 19 | P a g e . File Positions: The tell() method tells you the current position within the file in other words.mkdir("newdir") The chdir() Method: You can use the chdir() method to change the current directory. The fromargument specifies the reference position from where the bytes are to be moved. Simply Easy Learning fileObject.read([count]). it means use the beginning of the file as the reference position and 1 means use the current position as the reference position and if it is set to 2 then the end of the file would be taken as the reference position.chdir("newdir") The getcwd() Method: The getcwd() method displays the current working directory. which contains the name of the directory to be created. If from is set to 0.Tutorials Point. You need to supply an argument to this method. new_file_name) The remove() Method: Syntax: os. The offset argument indicates the number of bytes to be moved.
. ......... except ExceptionII: If there is ExceptionII. all the contents in it should be removed. 20 | P a g e ....... you can include an else-clause... You can also provide a generic except clause.. except: If there is any exception.else blocks: try: Do you operations here....getcwd() The rmdir() Method: The rmdir() method deletes the directory.. Here are few important points above the above mentioned syntax: A single try statement can have multiple except statements....... ... followed by a block of code which handles the problem as elegantly as possible.. Simply Easy Learning os... Before removing a directory....... Syntax: os.... This is useful when the try block contains statements that may throw different types of exceptions..... The except clause with no exceptions: You can also use the except statement with no exceptions defined as follows: try: Do you operations here. except ExceptionI: If there is ExceptionI.... which is passed as an argument in the method. The code in the else-block executes if the code in the try: block does not raise an exception.... then execute this block.. then execute this block. then execute this block....except....rmdir('dirname') Handling an exception: If you have some suspicious code that may raise an exception. which handles any exception. you can defend your program by placing the suspicious code in a try: block... Syntax: Here is simple syntax of try.. After the except clause(s)........ else: If there is no exception then execute this block..... .. include an except: statement.... The else-block is a good place for code that does not need the try: block's protection. else: If there is no exception then execute this block.........Tutorials Point. ... After the try: block...
...... . args [..... ..... which is a value that gives additional information about the problem.... The finally block is a place to put any code that must execute......... The general syntax for the raise statement... Standard Exceptions: Here is a list standard Exceptions available in Python: Standard Exceptions The try-finally clause: You can use a finally: block along with a try: block.. whether the try-block raised an exception or not....... traceback]]] 21 | P a g e ..... finally: This would always be executed.. except ExceptionType.. Simply Easy Learning The except clause with multiple exceptions: You can also use the same except statement to handle multiple exceptions as follows: try: Do you operations here.............ExceptionN]]]): If there is any exception from the given exception list. except(Exception1[.... Raising an exceptions: You can raise exceptions in several ways by using the raise statement.... The syntax of the tryfinally statement is this: try: Do you operations here. ...Tutorials Point..... .. Argument of an Exception: An exception can have an argument. Syntax: raise [Exception [..... Due to any exception............. else: If there is no exception then execute this block...... The contents of the argument vary by exception. ...... then execute this block..... You capture an exception's argument by supplying a variable in the except clause as follows: try: Do you operations here... Exception2[.......... Argument: You can print value of Argument here..... this may be skipped.
e: print e.__doc__. you call the class using class name and pass in whatever arguments its __init__ method accepts. Creating instance objects: To create instances of a class. The name of the class immediately follows the keyword class followed by a colon as follows: class ClassName: 'Optional class documentation string' class_suite The class has a documentation string which can be access via ClassName. and functions.Tutorials Point. 5000) Accessing attributes: You access the object's attributes using the dot operator with object. you can raise your exception as follows: try: raise Networkerror("Bad hostname") except Networkerror. This is useful when you need to display more specific information when an exception is caught. data attributes. class Networkerror(RuntimeError): def __init__(self. "This would create first object of Employee class" emp1 = Employee("Zara". 2000) "This would create second object of Employee class" emp2 = Employee("Manni".args = arg So once you defined above class. The variable e is used to create an instance of the class Networkerror. defining class members. Here is an example related to RuntimeError. arg): self. Here a class is created that is subclassed from RuntimeError.args Creating Classes: The class statement creates a new class definition. In the try block. Simply Easy Learning User-Defined Exceptions: Python also allows you to create your own exceptions by deriving classes from the standard built-in exceptions. The class_suite consists of all the component statements.displayEmployee() 22 | P a g e . Class variable would be accessed using class name as follows: emp1. the user-defined exception is raised and caught in the except block.
tuple...displayEmployee() print "Total Employee %d" % Employee. Syntax: Derived classes are declared much like their parent class. One reason for overriding parent's methods is because you may want special or different functionality in your subclass. An object's reference count changes as the number of aliases that point to it changes: An object's reference count increases when it's assigned a new name or placed in a container (list. you can create a class by deriving it from a preexisting class by listing the parent class in parentheses after the new class name: The child class inherits the attributes of its parent class. A child class can also override data members and methods from the parent.empCount Built-In Class Attributes: Every Python class keeps following built-in attributes and they can be accessed using dot operator like any other attribute: __dict__ : Dictionary containing the class's namespace. ParentClass2. however. The process by which Python periodically reclaims blocks of memory that no longer are in use is termed garbage collection.]): 'Optional class documentation string' class_suite Overriding Methods: You can always override your parent class methods. Class Inheritance: Instead of starting from scratch. The object's reference count decreases when it's deleted with del. Simply Easy Learning emp2. __bases__ : A possibly empty tuple containing the base classes. __module__: Module name in which the class is defined. a list of base classes to inherit from are given after the class name: class SubClassName (ParentClass1[. __name__: Class name. in the order of their occurrence in the base class list. __doc__ : Class documentation string. Python collects it automatically. This attribute is "__main__" in interactive mode. and you can use those attributes as if they were defined in the child class. . When an object's reference count reaches zero. or None if undefined.Tutorials Point. Destroying Objects (Garbage Collection): Python deletes unneeded objects (built-in types or class instances) automatically to free memory space. or dictionary). or its reference goes out of scope. 23 | P a g e . Python's garbage collector runs during program execution and is triggered when an object's reference count reaches zero. its reference is reassigned.
x) 2 3 4 5 Overloading Operators: Suppose you've created a Vector class to represent two-dimensional vectors.b = b 24 | P a g e . x ) Object comparison Sample Call : cmp(obj. define the __add__ method in your class to perform vector addition.args. You could.a = a self. What happens when you use the plus operator to add them? Most likely Python will yell at you.Tutorials Point.] ) Constructor (with any optional arguments) Sample Call : obj = className(args) __del__( self ) Destructor.myMethod() # instance of child # child calls overridden method Base Overloading Methods: Following table lists some generic functionality that you can override in your own classes: SN 1 Method. a... b): self. Simply Easy Learning class Parent: # define parent class def myMethod(self): print 'Calling parent method' class Child(Parent): # define child class def myMethod(self): print 'Calling child method' c = Child() c. deletes an object Sample Call : dell obj __repr__( self ) Evaluatable string representation Sample Call : repr(obj) __str__( self ) Printable string representation Sample Call : str(obj) __cmp__ ( self. and then the plus operator would behave as per expectation: #!/usr/bin/python class Vector: def __init__(self. Description & Sample Call __init__ ( self [. however.
Simply Easy Learning def __str__(self): return 'Vector (%d.other): return Vector(self.10) v2 = Vector(5. We would cover two important functions which would be used to handle regular expressions.b) v1 = Vector(2. and those attributes will not be directly visible to outsiders: #!/usr/bin/python class JustCounter: __secretCount = 0 def count(self): self. Regular expressions are widely used in UNIX world.b + other. The re module raises the exception re.__secretCount counter = JustCounter() counter.match(pattern.b) def __add__(self.count() print counter. %d)' % (self. Here is the syntax for this function: re. But a small thing first: There are various characters which would have special meaning when they are used in regular expression. using a specialized syntax held in a pattern. self.error if an error occurs while compiling or using a regular expression. self.count() counter. The match Function This function attempts to match RE pattern to string with optional flags. For these cases.__secretCount += 1 print self.a.a.Tutorials Point.-2) print v1 + v2 Data Hiding: An object's attributes may or may not be visible outside the class definition. The module re provides full support for Perl-like regular expressions in Python. flags=0) Here is the description of the parameters: Parameter Description 25 | P a g e . To avoid any confusion while dealing with regular expressions we would use Raw Strings as r'expression'. you can name attributes with a double underscore prefix. string.__secretCount A regular expression is a special sequence of characters that helps you match or find other strings or sets of strings.a + other.
None on failure. Simply Easy Learning pattern string flags This is the regular expression to be matched. Here is the syntax for this function: re. These are modifiers which are listed in the table below. string. flags=0) Here is the description of the parameters: Parameter pattern string flags Description This is the regular expression to be matched. Match Object Methods group(num=0) Description This methods returns entire match (or specific subgroup num) 26 | P a g e . The re. This is the string which would be searched to match the pattern You can specifiy different flags using exclusive OR (|). This is the string which would be searched to match the pattern You can specifiy different flags using exclusive OR (|). These are modifiers which are listed in the table below. The re. We would use group(num) or groups() function of match object to get matched expression. We would use group(num) or groups() function of match object to get matched expression.string(pattern.Tutorials Point.search function returns a match object on success.match function returns a match object on success. None on failure. Match Object Methods group(num=0) groups() Description This methods returns entire match (or specific subgroup num) This method return all matching subgroups in a tuple (empty if there weren't any) The search Function This function search for first occurrence of RE pattern within string with optional flags.
Interprets words according to the current locale.X Regular-expression patterns: 27 | P a g e . max=0) This method replace all occurrences of the RE pattern in string with repl.L Description Performs case-insensitive matching. substituting all occurrences unless max provided. re. while search checks for a match anywhere in the string (this is what Perl does by default). \b. \W.S re. The modifier are specified as an optional flag. Search and Replace: Some of the most important re methods that use regular expressions is sub. Permits "cuter" regular expression syntax. and treats unescaped # as a comment marker. This method would return modified string. as shown previously and may be represented by one of these: Modifier re. Makes $ match the end of a line (not just the end of the string) and makes ^ match the start of any line (not just the start of the string). It ignores whitespace (except inside a set [] or when escaped by a backslash). repl. Interprets letters according to the Unicode character set.M re.This interpretation affects the alphabetic group (\w and \W). as well as word boundary behavior (\b and \B). \B. Simply Easy Learning groups() This method return all matching subgroups in a tuple (empty if there weren't any) Matching vs Searching: Python offers two different primitive operations based on regular expressions: match checks for a match only at the beginning of the string. string.I re.U re. This flag affects the behavior of \w. You can provide multiple modified using exclusive OR (|).Option Flags Regular expression literals may include an optional modifier to control various aspects of matching.Tutorials Point. including a newline. Regular-expression Modifiers . Makes a period (dot) match any character. Syntax: sub(pattern.
Matches any single character in brackets. m. Matches end of line. only that area is affected. or x options within a regular expression. Matches either a or b.} re{ n. m.) 28 | P a g e . Matches 0 or 1 occurrence of preceding expression. or x options within parentheses. Simply Easy Learning Except for control characters. m} a| b (re) (?imx) (?-imx) (?: re) (?imx: re) (?-imx: re) (?#. (+ ? . or x options within parentheses.] re* re+ re{ n} re{ n.. Pattern ^ $ . You can escape a control character by preceding it with a backslash. Groups regular expressions without remembering matched text.... Matches n or more occurrences of preceding expression. only that area is affected. If in parentheses.. m. or x options within a regular expression. Comment. m.Tutorials Point. all characters match themselves. Temporarily toggles on i. Matches beginning of line. Groups regular expressions and remembers matched text. If in parentheses. Using m option allows it to match newline as well. Temporarily toggles on i.] [^. Following table lists the regular expression syntax that is available in Python. * ^ $ ( ) [ ] { } | \). Matches any single character except newline. Temporarily toggles off i.. Description [. Matches exactly n number of occurrences of preceding expression. Temporarily toggles off i. Matches any single character not in brackets Matches 0 or more occurrences of preceding expression. Matches at least n and at most m occurrences of preceding expression.
Doesn't have a range. Matches independent pattern without backtracking. Matches end of string. \t. Specifies position using pattern negation. Matches backspace (0x08) when inside brackets. Simply Easy Learning (?= re) (?! re) (?> re) \w \W \s \S \d \D \A \Z Specifies position using a pattern. \z \G \b \B \n. etc.\9 \10 Regular-expression Examples: Literal characters: Example Description 29 | P a g e . Equivalent to [\t\n\r\f]. \1. Doesn't have a range. Matches beginning of string.. Matches nonword characters. Matches nonwhitespace. Matches point where last match finished. If a newline exists. Matches nonword boundaries. tabs.Tutorials Point. carriage returns. Matches digits. Matches whitespace. Matches word boundaries when outside brackets. Otherwise refers to the octal representation of a character code. etc. it matches just before newline. Matches newlines. Matches nth grouped subexpression if it matched already. Equivalent to [0-9]. Matches nth grouped subexpression. Matches nondigits. Matches word characters.. Matches end of string.
Simply Easy Learning python Match "python". \d \D \s \S \w \W Description Match any character except newline Match a digit: [0-9] Match a nondigit: [^0-9] Match a whitespace character: [ \t\r\n\f] Match nonwhitespace: [^ \t\r\n\f] Match a single word character: [A-Za-z0-9_] Match a nonword character: [^A-Za-z0-9_] Repetition Cases: 30 | P a g e .Tutorials Point. Character classes: Example [Pp]ython rub[ye] [aeiou] [0-9] [a-z] [A-Z] [a-zA-Z0-9] [^aeiou] [^0-9] Match "Python" or "python" Match "ruby" or "rube" Match any one lowercase vowel Match any digit. same as [0123456789] Match any lowercase ASCII letter Match any uppercase ASCII letter Match any of the above Match anything other than a lowercase vowel Match anything other than a digit Description Special Character Classes: Example .
Tutorials Point. )?)+ No group: + repeats \d Grouped: + repeats \D\d pair Match "Python". etc. python. Description Backreferences: This matches a previously matched group again: Example ([Pp])ython&\1ails (['"])[^\1]*\1 Description Match python&rails or Python&Rails Single or double-quoted string. 4.*?> Description Greedy repetition: matches "<python>perl>" Nongreedy: matches "<python>" in "<python>perl>" Grouping with parentheses: Example \D\d+ (\D\d)+ ([Pp]ython(. Simply Easy Learning Example ruby? ruby* ruby+ \d{3} \d{3.5} Description Match "rub" or "ruby": the y is optional Match "rub" plus 0 or more ys Match "rub" plus 1 or more ys Match exactly 3 digits Match 3 or more digits Match 3. "Python.} \d{3. python". or 5 digits Nongreedy repetition: This matches the smallest number of repetitions: Example <.*> <. \1 matches whatever the 1st group 31 | P a g e .
etc.Tutorials Point. \2 matches whatever the 2nd group matched. Alternatives: Example python|perl rub(y|le)) Python(!+|\?) Match "python" or "perl" Match "ruby" or "ruble" "Python" followed by one or more ! or one ? Description Anchors: This need to specify match position Example ^Python Python$ \APython Python\Z \bPython\b \brub\B Description Match "Python" at the start of a string or internal line Match "Python" at the end of a string or line Match "Python" at the start of a string Match "Python" at the end of a string Match "Python" at a word boundary \B is nonword boundary: match "rub" in "rube" and "ruby" but not alone Match "Python". if not followed by an exclamation point Python(?=!) Python(?!!) Special syntax with parentheses: Example R(?#comment) R(?i)uby Description Matches "R". if followed by an exclamation point Match "Python". All the rest is a comment Case-insensitive while matching "uby" 32 | P a g e . Simply Easy Learning matched .
Acquiring a connection with the database.0. using Python structures and syntax wherever possible. Just type the following in your Python script and execute it: #!/usr/bin/python 33 | P a g e . It implements the Python Database API v2. The DB API provides a minimal standard for working with databases. Closing the connection We would learn all the concepts using MySQL so let's talk about MySQLdb module only. Issuing SQL statements and stored procedures. This API includes the following: Importing the api module. For example. You can choose the right database for your application. What is MySQLdb? MySQLdb is an interface for connecting to a MySQL database server from Python. Simply Easy Learning R(?i:uby) rub(?:y|le)) Same as above Group only without creating \1 backreference MySQL Database Access The Python standard for database interfaces is the Python DB-API. Python Database API supports a wide range of database servers: GadFly mSQL MySQL PostgreSQL Microsoft SQL Server 2000 Informix Interbase Oracle Sybase Here is the list of available Python databases interfaces: Python Database Interfaces and APIs You must download a separate DB API module for each database you need to access. you must download both the Oracle and the MySQL database modules. and is built on top of the MySQL C API.Tutorials Point. Most Python database interfaces adhere to this standard. if you need to access an Oracle database as well as a MySQL database. How do I install the MySQLdb? Before proceeding you make sure you have MySQLdb installed on your machine.
User ID "testuser" and password "test123" are set to access TESTDB Python module MySQLdb is installed properly on your machine.2 python setup. cursor.2.py build python setup. in <module> import MySQLdb ImportError: No module named MySQLdb To install MySQLdb module."testuser". SEX and INCOME."TESTDB" ) # prepare a cursor object using cursor() method cursor = db.fetchone() print "Database version : %s " % data # disconnect from server 34 | P a g e .py".2.Tutorials Point. LAST_NAME. Simply Easy Learning import MySQLdb If it produces following result then it means MySQLdb module is not installed: Traceback (most recent call last): File "test.gz tar -xvf MySQL-python-1.2. data = cursor. AGE.py install Note: Make sure you have root privilege to install above module. download it from MySQLdb Download page and proceed as follows: $ $ $ $ $ gunzip MySQL-python-1. line 3.execute("SELECT VERSION()") # Fetch a single row using fetchone() method.2.2.cursor() # execute SQL query using execute() method.connect("localhost".tar cd MySQL-python-1. You have gone through MySQL tutorial to understand MySQL Basics. This table is having fields FIRST_NAME."test123". Example: Following is the example of connecting with MySQL database "TESTDB" #!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb. Database Connection: Before connecting to a MySQL database make sure followings: You have created a database TESTDB. You have created a table EMPLOYEE in TESTDB.tar.
close() While running this script. AGE INT.connect("localhost"."TESTDB" ) # prepare a cursor object using cursor() method cursor = db. Example: First let's create Database table EMPLOYEE: #!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb.execute("DROP TABLE IF EXISTS EMPLOYEE") # Create table as per requirement sql = """CREATE TABLE EMPLOYEE ( FIRST_NAME CHAR(20) NOT NULL."test123". its producing following result at my Linux machine. Example: 35 | P a g e .Tutorials Point. Creating Database Table: Once a database connection is established. we are ready to create tables or records into the database tables using execute method of the created cursor."testuser". Database version : 5.execute(sql) # disconnect from server db. cursor. Simply Easy Learning db. SEX CHAR(1). Finally before coming out it ensures that database connection is closed and resources are released. LAST_NAME CHAR(20).0.45 If a connection is established with the datasource then a Connection Object is returned and saved into db for further use otherwise db is set to None. INCOME FLOAT )""" cursor.cursor() # Drop table if it already exist using execute() method.close() INSERT Operation: INSERT operation is required when you want to create your records into a database table. Next db object is used to create a cursor object which in turn is used to execute SQL queries.
2000)""" try: # Execute the SQL command cursor. 20."test123". LAST_NAME. INCOME) \ VALUES ('%s'.close() Example: 36 | P a g e . '%d' )" % \ ('Mac'."testuser".connect("localhost".commit() except: # Rollback in case there is any error db. AGE.cursor() # Prepare SQL query to INSERT a record into the database.connect("localhost"."test123". sql = "INSERT INTO EMPLOYEE(FIRST_NAME. INCOME) VALUES ('Mac'."testuser". #!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb. SEX. '%c'. sql = """INSERT INTO EMPLOYEE(FIRST_NAME.commit() except: # Rollback in case there is any error db.close() Above example can be written as follows to create SQL queries dynamically: #!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb. SEX.rollback() # disconnect from server db. 'M'. 'Mohan'."TESTDB" ) # prepare a cursor object using cursor() method cursor = db. 'Mohan'. '%s'. 20.rollback() # disconnect from server db. \ LAST_NAME. AGE.Tutorials Point."TESTDB" ) # prepare a cursor object using cursor() method cursor = db. Simply Easy Learning Following is the example which executes SQL INSERT statement to create a record into EMPLOYEE table. 2000) try: # Execute the SQL command cursor.cursor() # Prepare SQL query to INSERT a record into the database. 'M'.execute(sql) # Commit your changes in the database db.execute(sql) # Commit your changes in the database db. '%d'.
. sql = "SELECT * FROM EMPLOYEE \ WHERE INCOME > '%d'" % (1000) try: # Execute the SQL command cursor."test123".....execute(sql) # Fetch all the rows in a list of lists.. user_id = "test123" password = "password" con.....fetchall() for row in results: fname = row[0] lname = row[1] age = row[2] sex = row[3] income = row[4] # Now print fetched result print "fname=%s.... we are ready to make a query into this database.... "%s")' % \ (user_id... We can use either fetchone() method to fetch single record or fetchall method to fetech multiple values from a database table.."testuser".."TESTDB" ) # prepare a cursor object using cursor() method cursor = db.cursor() # Prepare SQL query to INSERT a record into the database.execute('insert into Login values("%s". results = cursor... Simply Easy Learning Following code segment is another form of execute where you can pass parameters directly: .. the fetchall() method retrieves the remaining rows from the result set. #!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb.....sex=%s....... READ Operation: READ Operation on any databasse means to fetch some useful information from the database.income=%d" % \ 37 | P a g e .... Once our database connection is established... password)) .connect("localhost"........ A result set is an object that is returned when a cursor object is used to query a table.... Example: Following is the procedure to query all the records from EMPLOYEE table having salary more than 1000.... If some rows have already been extracted from the result set. fetchall(): This method fetches all the rows in a result set....lname=%s... rowcount: This is a read-only attribute and returns the number of rows that were affected by an execute() method.age=%d........ fetchone(): This method fetches the next row of a query result set.Tutorials Point....
income ) except: print "Error: unable to fecth data" # disconnect from server db. Following is the procedure to delete all the records from EMPLOYEE where AGE is more than 20. Example: #!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb.close() This will produce following result: fname=Mac. age=20.commit() except: # Rollback in case there is any error db.execute(sql) # Commit your changes in the database db. income=2000 Update Operation: UPDATE Operation on any databasse means to update one or more records which are already available in the database. sex. Simply Easy Learning (fname.close() DELETE Operation: DELETE operation is required when you want to delete some records from your database."test123".cursor() # Prepare SQL query to UPDATE required records sql = "UPDATE EMPLOYEE SET AGE = AGE + 1 WHERE SEX = '%c'" % ('M') try: # Execute the SQL command cursor. age. sex=M.Tutorials Point."TESTDB" ) # prepare a cursor object using cursor() method cursor = db. Here we will increase AGE of all the males by one year."testuser". lname. lname=Mohan.rollback() # disconnect from server db. Following is the procedure to update all the records having SEX as 'M'.connect("localhost". Example: #!/usr/bin/python import MySQLdb # Open database connection 38 | P a g e .
commit() except: # Rollback in case there is any error db. even after a system failure. Consistency: A transaction must start in a consistent state and leave the system is a consistent state.rollback() # disconnect from server db. The Python DB API 2. Here is a simple example to call commit method.Tutorials Point.0 provides two methods to either commit or rollback a transaction. the effects are persistent."test123".rollback() COMMIT Operation: Commit is the operation which gives a green signal to database to finalize the changes and after this operation no change can be reverted back. Simply Easy Learning db = MySQLdb. Example: You already have seen how we have implemented transations. Durability: Once a transaction was committed.cursor() # Prepare SQL query to DELETE required records sql = "DELETE FROM EMPLOYEE WHERE AGE > '%d'" % (20) try: # Execute the SQL command cursor."TESTDB" ) # prepare a cursor object using cursor() method cursor = db. Here is again similar example: # Prepare SQL query to DELETE required records sql = "DELETE FROM EMPLOYEE WHERE AGE > '%d'" % (20) try: # Execute the SQL command cursor.execute(sql) # Commit your changes in the database db. Isolation: Intermediate results of a transaction are not visible outside the current transaction.close() Performing Transactions: Transactions are a mechanism that ensures data consistency.commit() except: # Rollback in case there is any error db. Transactions should have the following four properties: Atomicity: Either a transaction completes or nothing happens at all."testuser".execute(sql) # Commit your changes in the database db.connect("localhost". 39 | P a g e .
Used for errors in the database module. a connection failure. or calling the fetch method for an already canceled or finished statement handle. The following table lists these exceptions. your application would be better off calling commit or rollback explicitly. instead of depending on any of DB lower level implementation details.rollback() Disconnecting Database: To disconnect Database connection. Exception Warning Error InterfaceError Description Used for non-fatal issues. Subclass of DatabaseError that refers to errors such as the loss of a connection to the database. However. Must subclass Error. Handling Errors: There are many sources of errors. Must subclass StandardError. Used for errors in the database. DatabaseError DataError OperationalError 40 | P a g e . These errors are generally outside of the control of the Python scripter. The DB API defines a number of errors that must exist in each database module.close() If the connection to a database is closed by the user with the close() method. Subclass of DatabaseError that refers to errors in the data.Tutorials Point. Must subclass Error. not the database itself. Base class for errors.commit() ROLLBACK Operation: If you are not satisfied with one or more of the changes and you want to revert back those changes completely then use rollback method. db. db. A few examples are a syntax error in an executed SQL statement. Must subclass StandardError. use close() method. Simply Easy Learning db. Here is a simple example to call rollback metho. any outstanding transactions are rolled back by the DB.
make sure your MySQLdb has support for that exception. which will typically be used to do the work of mailing a message. Try it once: 41 | P a g e . Example: Here is a simple way to send one email using Python script.SMTP( [host [. Your Python scripts should handle these errors but before using any of the above exceptions.A list of strings. An SMTP object has an instance method called sendmail. Usually this port would be 25.A string with the address of the sender. You can specifiy IP address of the host or a domain name like tutorialspoint. port [. Simply Easy Learning IntegrityError Subclass of DatabaseError for situations that would damage the relational integrity. port: If you are providing host argument then you need to specifiy a port where SMTP server is listening. such as uniqueness constraints or foreign keys. The message . This is optional argument. Subclass of DatabaseError that refers to errors such as a bad table name and other things that can safely be blamed on you. The receivers . such as a cursor no longer being active. one for each recipient. Here is a simple syntax to create one SMTP object which can later be used to send an email: import smtplib smtpObj = smtplib. local_hostname]]] ) Here is the detail of the parameters: host: This is the host running your SMTP server.com. You can get more information about them by reading the DB API 2.A message as a string formatted as specified in the various RFCs.0 specification.Tutorials Point. local_hostname: If your SMTP server is running on your local machine then you can specify just localhost as of this option. Sending Email using SMTP Simple Mail Transfer Protocol (SMTP) is a protocol which handles sending e-mail and routing email between mail servers. InternalError ProgrammingError NotSupportedError Subclass of DatabaseError that refers to trying to call unsupported functionality. It takes three parameters: The sender . Subclass of DatabaseError that refers to errors internal to the database module. Python provides smtplib module which defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon.
Try it once: #!/usr/bin/python import smtplib message = """From: From Person <from@fromdomain. content type and character set to send an HTML email.com'. Unless you're using a webmail service (such as Hotmail or Yahoo! Mail). your e-mail provider will have provided you with outgoing mail server details that you can supply them. taking care to format the headers correctly. An e-mails requires a From. you can use smtplib client to communicate with a remote SMTP server. it will be displayed as simple text and HTML tags will not be formatted according to HTML syntax.com> To: To Person <email@example.com> Subject: SMTP e-mail test This is a test e-mail message.com' receivers = ['to@todomain. """ try: smtpObj = smtplib. separated from the body of the e-mail with a blank line. If you're not running an SMTP server on your local machine. and the destination address as parameters (even though the from and to addresses are within the e-mail itself. 25) Sending an HTML email using Python: When you send a text message using Python then all the content will be treated as simple text. receivers. using a triple quote. To.com> To: To Person <to@todomain. Example: Following is the example to send HTML content as an email.com> 42 | P a g e .SMTP('localhost') smtpObj. these aren't always used to route mail). But Python provides option to send an HTML message as actual HTML message.SMTP('mail. the from address. While sending an email message you can specify a Mime version. message) print "Successfully sent email" except SMTPException: print "Error: unable to send email" Here you have placed a basic e-mail in message. as follows: smtplib.your-domain. Even if you will include HTML tags in a text message. and Subject header.Tutorials Point. To send the mail you use smtpObj to connect to the SMTP server on the local machine and then use the sendmail method along with the message.sendmail(sender.com'] message = """From: From Person <from@fromdomain. Simply Easy Learning #!/usr/bin/python import smtplib sender = 'from@fromdomain.
Attached files should be encoded with the pack("m") function to have base64 encoding before transmission.0 # base64 43 | P a g e .read() encodedcontent = base64. """ # Define the main firstname.lastname@example.com@gmail. message) print "Successfully sent email" except SMTPException: print "Error: unable to send email" Sending Attachements as an e-mail: To send an email with mixed content requires to set Content-type header multipart/mixed. to A boundary is started with two hyphens followed by a unique number which can not appear in the message part of the email. Try it once: #!/usr/bin/python import smtplib import base64 filename = "/tmp/test. receivers. Then text and attachment sections can be specified within boundaries. Example: Following is the example which will send a file /tmp/test. "rb") filecontent = fo.Tutorials Point.txt" # Read a file and encode it into base64 format fo = open(filename.com> Subject: Sending Attachement MIME-Version: 1.b64encode(filecontent) sender = 'firstname.lastname@example.com('localhost') smtpObj.sendmail(sender.com' marker = "AUNIQUEMARKER" body =""" This is a test email to send an attachement.</b> <h1>This is headline. A final boundary denoting the email's final section must also end with two hyphens.</h1> """ try: smtpObj = smtplib. part1 = """From: From Person <email@example.com> To: To Person <amrood.0 Content-type: text/html Subject: SMTP HTML e-mail test This is an e-mail message to be sent in HTML format <b>This is HTML message.txt as an attachment. Simply Easy Learning MIME-Version: 1.com' reciever = 'amrood.
filename=%s %s --%s-""" %(filename. marker) message = part1 + part2 + part3 try: smtpObj = smtplib. kwargs] ) This method call enables a fast and efficient way to create new threads in both Linux and Windows. encodedcontent.Tutorials Point. It can be pre-empted (interrupted) It can temporarily be put on hold (also known as sleeping) while other threads are running .this is called yielding. you need to call following method available in thread module: thread. args[. A thread has a beginning. Threads sometimes called light-weight processes and they do not require much memory overhead. an execution sequence. marker) # Define the message action part2 = """Content-Type: text/plain Content-Transfer-Encoding:8bit %s --%s """ % (body.SMTP('localhost') smtpObj. and a conclusion. filename.sendmail(sender.start_new_thread ( function. 44 | P a g e . Starting a New Thread: To spawn another thread. theycare cheaper than processes. reciever. name=\"%s\" Content-Transfer-Encoding:base64 Content-Disposition: attachment. boundary=%s --%s """ % (marker. but with the following benefits: Multiple threads within a process share the same data space with the main thread and can therefore share information or communicate with each other more easily than if they were separate processes. message) print "Successfully sent email" except Exception: print "Error: unable to send email" Multithreaded Programming Running several threads is similar to running several different programs concurrently.marker) # Define the attachment section part3 = """Content-Type: multipart/mixed. Simply Easy Learning Content-Type: multipart/mixed. It has an instruction pointer that keeps track of where within its context it is currently running.
When function returns. 4. high-level support for threads than the thread module discussed in the previous section. The threading module exposes all the methods of the thread module and provides some additional methods: threading. The Threading Module: The newer threading module included with Python 2. 45 | P a g e .activeCount(): Returns the number of thread objects that are active. 2. time. ("Thread-2". ("Thread-1".time()) ) # Create two threads as follows try: thread. Here args is a tuple of arguments.sleep(delay) count += 1 print "%s: %s" % ( threadName.currentThread(): Returns the number of thread objects in the caller's thread control. the thread terminates. threading.start_new_thread( print_time. use an empty tuple to call function without passing any arguments.Tutorials Point. delay): count = 0 while count < 5: time. kwargs is an optional dictionary of keyword arguments. Simply Easy Learning The method call returns immediately and the child thread starts and calls function with the passed list of agrs.start_new_thread( print_time. ) ) thread. but the thread module is very limited compared to the newer threading module.4 provides much more powerful.ctime(time. Example: #!/usr/bin/python import thread import time # Define a function for the thread def print_time( threadName. ) ) except: print "Error: unable to start thread" while 1: pass This would produce following result: Thread-1: Thread-1: Thread-2: Thread-1: Thread-2: Thread-1: Thread-1: Thread-2: Thread-2: Thread-2: Thu Thu Thu Thu Thu Thu Thu Thu Thu Thu Jan Jan Jan Jan Jan Jan Jan Jan Jan Jan 22 22 22 22 22 22 22 22 22 22 15:42:17 15:42:19 15:42:19 15:42:21 15:42:23 15:42:23 15:42:25 15:42:27 15:42:31 15:42:35 2009 2009 2009 2009 2009 2009 2009 2009 2009 2009 Although it is very effective for low-level threading.
The methods provided by the Thread class are as follows: run(): The run() method is the entry point for a thread. name. Creating Thread using Threading Module: To implement a new thread using the threading module. 2) # Start new Threads thread1.Thread. start(): The start() method starts a thread by calling the run method. Simply Easy Learning threading. join([time]): The join() waits for threads to terminate. Override the __init__(self [. Then override the run(self [. you have to do the following: Define a new subclass of the Thread class.name print_time(self.name.name = name self.Thread): def __init__(self.counter = counter threading. 5) print "Exiting " + self.exit() time. counter): while counter: if exitFlag: thread. Example: #!/usr/bin/python import threading import time exitFlag = 0 class myThread (threading.enumerate(): Returns a list of all thread objects that are currently active. 1) thread2 = myThread(2.ctime(time. time. the threading module has the Thread class that implements threading. delay.Tutorials Point.counter.name def print_time(threadName. In addition to the methods.__init__(self) def run(self): print "Starting " + self. "Thread-1".args]) method to implement what the thread should do when started. threadID. "Thread-2". you can create an instance of it and then start a new thread by invoking the start() or run() methods. getName(): The getName() method returns the name of a thread. self.start() 46 | P a g e . Once you have created the new Thread subclass.threadID = threadID self. isAlive(): The isAlive() method checks whether a thread is still executing.sleep(delay) print "%s: %s" % (threadName. counter): self.args]) method to add additional arguments.time())) counter -= 1 # Create new threads thread1 = myThread(1. setName(): The setName() method sets the name of a thread.
the thread will block and wait for the lock to be released. If blocking is set to 0. threadID. Simply Easy Learning thread2. The acquire(blocking) method the new lock object would be used to force threads to run synchronously.__init__(self) def run(self): 47 | P a g e .threadID = threadID self. Example: #!/usr/bin/python import threading import time class myThread (threading.Thread.isAlive(): exitFlag = 1 pass print "Exiting Main Thread" This would produce following result: Starting Thread-2 Starting Thread-1 Thread-1: Thu Jan 22 Thread-2: Thu Jan 22 Thread-1: Thu Jan 22 Thread-1: Thu Jan 22 Thread-2: Thu Jan 22 Thread-1: Thu Jan 22 Thread-1: Thu Jan 22 Exiting Thread-1 Thread-2: Thu Jan 22 Thread-2: Thu Jan 22 Thread-2: Thu Jan 22 Exiting Thread-2 Exiting Main Thread 15:53:05 15:53:06 15:53:06 15:53:07 15:53:08 15:53:08 15:53:09 2009 2009 2009 2009 2009 2009 2009 15:53:10 2009 15:53:12 2009 15:53:14 2009 Synchronizing Threads: The threading module provided with Python includes a simple-to-implement locking mechanism that will allow you to synchronize threads. A new lock is created by calling the Lock() method. The optional blocking parameter enables you to control whether the thread will wait to acquire the lock. which returns the new lock.Thread): def __init__(self.counter = counter threading. name.Tutorials Point.name = name self. the thread will return immediately with a 0 value if the lock cannot be acquired and with a 1 if the lock was acquired.run() while thread2. The release() method of the the new lock object would be used to release the lock when it is no longer required.isAlive(): if not thread1. counter): self. If blocking is set to 1.
False.start() thread2.name. 1) thread2 = myThread(2.Tutorials Point. otherwise. There are following methods to control the Queue: get(): The get() removes and returns an item from the queue. time. full(): the full() returns True if queue is full.acquire() print_time(self.release() def print_time(threadName.start() # Add threads to thread list threads. qsize() : The qsize() returns the number of items that are currently in the queue.append(thread2) # Wait for all threads to complete for t in threads: t. Simply Easy Learning print "Starting " + self.append(thread1) threads. 2) # Start new Threads thread1. "Thread-2". Example: 48 | P a g e . otherwise.sleep(delay) print "%s: %s" % (threadName. False. 3) # Free lock to release next thread threadLock. "Thread-1". counter): while counter: time.Lock() threads = [] # Create new threads thread1 = myThread(1. delay. empty(): The empty( ) returns True if queue is empty.ctime(time.time())) counter -= 1 threadLock = threading. self.join() print "Exiting Main Thread" This would produce following result: Starting Thread-1 Starting Thread-2 Thread01: Thu Jan 22 Thread01: Thu Jan 22 Thread01: Thu Jan 22 Thread02: Thu Jan 22 Thread02: Thu Jan 22 Thread02: Thu Jan 22 Exiting Main Thread 16:04:38 16:04:39 16:04:40 16:04:42 16:04:44 16:04:46 2009 2009 2009 2009 2009 2009 Multithreaded Priority Queue: The Queue module allows you to create a new queue object that can hold a specific number of items. put(): The put adds item to a queue.name # Get lock to synchronize threads threadLock.counter.
Queue(10) threads = [] threadID = 1 # Create new threads for tName in threadList: thread = myThread(threadID.Thread): def __init__(self.start() threads.empty(): pass # Notify threads it's time to exit exitFlag = 1 # Wait for all threads to complete for t in threads: t. Simply Easy Learning #!/usr/bin/python import Queue import threading import time exitFlag = 0 class myThread (threading. "Two".acquire() if not workQueue. threadID.name.q) print "Exiting " + self.name def process_data(threadName. workQueue) thread.Tutorials Point.acquire() for word in nameList: workQueue. name.name = name self.release() # Wait for queue to empty while not workQueue. q): self. self. "Four". "Three".name process_data(self.Thread. q): while not exitFlag: queueLock.get() queueLock.sleep(1) threadList = ["Thread-1".Lock() workQueue = Queue.append(thread) threadID += 1 # Fill the queue queueLock.join() print "Exiting Main Thread" 49 | P a g e .__init__(self) def run(self): print "Starting " + self. "Thread-3"] nameList = ["One".release() print "%s processing %s" % (threadName.q = q threading.empty(): data = q. "Thread-2". tName. "Five"] queueLock = threading.release() time.put(word) queueLock.threadID = threadID self. data) else: queueLock.
aculo.us Web Developer's Guide Learn RADIUS Learn RSS Learn SEO Techniques Learn SOAP Learn UDDI Learn Unix Sockets Learn Web Services Learn XML-RPC Learn UML Learn UNIX Learn WSDL Learn i-Mode Learn GPRS Learn GSM 50 | P a g e .com Learn JSP Learn Servlets Learn log4j Learn iBATIS Learn Java Learn JDBC Java Examples Learn Best Practices Learn Python Learn Ruby Learn Ruby on Rails Learn SQL Learn MySQL Learn AJAX Learn C Programming Learn C++ Programming Learn CGI with PERL Learn DLL Learn ebXML Learn Euphoria Learn GDB Debugger Learn Makefile Learn Parrot Learn Perl Script Learn PHP Script Learn ASP.tutorialspoint.Net Learn HTML Learn HTML5 Learn XHTML Learn CSS Learn HTTP Learn JavaScript Learn jQuery Learn Prototype Learn script.com/python List of Tutorials from TutorialsPoint.Tutorials Point. Simply Easy Learning This would produce following result: Starting Thread-2 Starting Thread-1 Starting Thread-3 Thread-2 processing Thread-1 processing Thread-3 processing Thread-2 processing Thread-1 processing Exiting Thread-3 Exiting Thread-2 Exiting Thread-1 Exiting Main Thread One Two Three Four Five Further Detail: Refer to the link http://www.
com 51 | P a g e .Tutorials Point. Simply Easy Learning Learn Six Sigma Learn SEI CMMI Learn WiMAX Learn Telecom Billing Learn WAP Learn WML Learn Wi-Fi webmaster@TutorialsPoint.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue listening from where you left off, or restart the preview.


text:
Subscribe on YouTubephp developer india
- php developer india
Tour Dates
Instagram photos
Category Archives: News
That's right! We are happy to announce that we are working on a new album! Will be ready for this summer, so stay tuned! We will keep you updated as we progress and can't wait to share new songs with Read More
Candice's European Tour Diary:Part 6
SATURDAY OCTOBER 24th- We woke up the next morning at Martin's house. I think I was up first so I made some eggs for breakfast. We kind of just lounged around the house until about noon or so which was Read More
Limited time Holiday sale PLUS new store items!!!
Announcing new tshirts, hats and posters on our webstore!!! And in honor of CyberMonday, we are now taking orders for Candice's cut up custom tees! This offer only good from today through the end of Cyber Monday! So don't miss Read More
Candice's European Tour Diary: Part 5
OCTOBER 22nd – THURSDAY I have 2 questions about Germany: 1) why does almost everyone smoke? 2) why does everyone who smoke insist on smoking inside?… When we got to the venue Wood and Waves in Heide on Thursday I Read More

subset: commoncrawl


text:
New study finds link between Daylight Saving Time and strokes
Experts recommend getting between seven to nine hours of sleep a night, but the Daylight Saving Time transition could make that difficult.
Experts recommend getting between seven to nine hours of sleep a night, but the Daylight Saving Time transition could make that difficult.
Doctors say it's time to prepare for spring, and the seasonal allergies that come along with it.
Doctors at the Cleveland Clinic released a statement Wednesday saying that the patient, identified only by her first name, suffered from a "…
With so many food items disguised as "healthy," it's often hard to know what's really good for you and what's not.
There have been no cases of the Zika virus reported in Birmingham, but trucks from the City of Birmingham public works will be spraying in 9…
At issue, should oral immunotherapy – OIT- be offered as standard treatment?
The U.S. Food and Drug Administration on Monday announced new actions to further regulate the controversial birth control product Essure.
It's American Heart Month and you should celebrate by feeding your body the right foods.
Especially popular among teens, the headphones are known for their bass-boosting, high-fidelity sound.
As part of Eating Disorder Awareness Week, it is import to take note that 30 million Americans now suffer the disorders, two-thirds of them …
Five women have come forward claiming their health was put at risk during their pregnancies because of a Muskegon hospital's religious affil…
A study by Hasbro Children's Hospital has found signs of widespread cyberbullying and peer violence among teens.
Think coffee is a healthier alternative to soda? Think again–your favorite Starbucks drink could have way more than the recommended daily am…
The World Health Organization said the controversial method could successfully kill the mosquitoes that carry it.
Are there some things you might be overlooking that could be making your family sick?


text:
Related videos
You need to upgrade your Adobe Flash Player to watch this video.
Download it from Adobe.
Download it from Adobe.
Haru Sakuragi Asian schoolgirl has sex part6
Submitted by Spankydude 1588 days ago Website: JP SchoolGirls
- 48I like
this videoThank you for voting!
- I dislike
this videoThank you for voting!
FavouritesAdd to favorites
Thank you for favoriting!
Subcribe to this video owner
Best videos of the day
100%11:13 Seductive brunette gets her lovely snatch eaten out and pou 100%06:34 Cheat with 40 that is dark 100%27:43 Young blonde home alone 100%06:06 Fuck that is German and cosmetic 100%10:00 large titties large bootie 71%29:11 Valentine Cuckold 100%01:18 Skinny young chick wants to learn how to make you hard with 50%06:00 Hardcore group sex with three hot sluts 86%01:23 Old woman shows her big shaggy tits 50%05:10 Hot Greek babe Christina eats his meat before he pounds her 73%32:19 Brunette makes bounce her big saggy tits 90%05:30 Houseoftaboo with subtle latex clothing


text:
The Leading eBooks Store Online
3,603,993 members ⚫ 1,165,375 ebooks
New to eBooks.com?Learn more
- Bestsellers - This Week
- Foreign Language Study
- Pets
- Bestsellers - Last 6 months
- Games
- Philosophy
- Archaeology
- Gardening
- Photography
- Architecture
- Graphic Books
- Poetry
- Art
- Health & Fitness
- Political Science
- Biography & Autobiography
- History
- Psychology & Psychiatry
- Body Mind & Spirit
- House & Home
- Reference
- Business & Economics
- Humor
- Religion
- Children's & Young Adult Fiction
- Juvenile Nonfiction
- Romance
- Computers
- Language Arts & Disciplines
- Science
- Crafts & Hobbies
- Law
- Science Fiction
- Current Events
- Literary Collections
- Self-Help
- Drama
- Literary Criticism
- Sex
- Education
- Literary Fiction
- Social Science
- The Environment
- Mathematics
- Sports & Recreation
- Family & Relationships
- Media
- Study Aids
- Fantasy
- Medical
- Technology
- Fiction
- Music
- Transportation
- Folklore & Mythology
- Nature
- Travel
- Food and Wine
- Performing Arts
- True Crime
- Foreign Language Books
Most popular at the top
Contagion and EnclavesLiverpool University Press 2012; US$ 72.99 US$ 62.77
Contagion and Enclaves studies the social history of medicine within two intersecting enclaves in colonial India; the hill station of Darjeeling which incorporated the sanitarian and racial norms of the British Raj; and in the adjacent tea plantations of North Bengal, which produced tea for the global market. more...
Constitution-making in AsiaTaylor and Francis 2016; US$ 54.95
Britain?s main imperial possessions in Asia were granted independence in the 1940s and 1950s and needed to craft constitutions for their new states. Invariably the indigenous elites drew upon British constitutional ideas and institutions regardless of the political conditions that prevailed in their very different lands. Many Asian nations called... more...
A Companion to South Asia in the PastWiley 2016; US$ 54.95 US$ 47.62
A Companion to South Asia in the Past provides the definitive overview of research and knowledge about South Asia's past, from the Pleistocene to the historic era in India, Pakistan, Sri Lanka, Bangladesh and Nepal, provided by a truly global team of experts. The most comprehensive and detailed scholarly treatment of South Asian archaeology... more...
Learning femininity in colonial India, 1820-1932Manchester University Press 2016; US$ 109.99 US$ 94.59
This book explores the situation of women in colonial India between 1820 and 1932. Making use of innovative theorisation, it explains the framework of colonial change over this long period, providing important context for the women who lived and worked in Asian colonial domains generally. In the middle of the nineteenth century the British raj created... more...
Remnants of the Sikh EmpireHay House 2015; US$ 11.99 US$ 8.82
A fascinating chronicle that focuses on architectural gems of the Sikh EmpireRemnants of the Sikh Empire is a unique guide to the many important Sikh monuments located both in India and Pakistan. It catalogues numerous structures historically associated with the reign of Maharaja Ranjit Singh during the early nineteenth century. From Mughal to Sikh... more...
The Great Mughals and their IndiaHay House 2016; US$ 11.99 US$ 8.82
A definitive, comprehensive and engrossing chronicle of one of the greatest dynasties of the world - the Mughal - from its founderBabur to Bahadur Shah Zafar, the last of the clanThe magnificent Mughal legacy - the world-famous Taj Mahal being the most prominent among countless other examples - is an inexhaustible source of inspiration to historians,... more...
The Kama Sutra of VatsyayanaMobileReference.com 2010; US$ 3.99
The Kama Sutra (alternative spellings: Kamasutram or simply Kamasutra), is an ancient Indian text widely considered to be the standard work on human sexual behavior in Sanskrit literature written by the Indian scholar Vatsyayana. A portion of the work consists of practical advice on sex. Kama means sensual or sexual pleasure, and sutra are the guidlines... more...
The Mughal EmpireCambridge University Press 1993; US$ 40.00 US$ 32.80
The Mughal empire was one of the largest centralised states in the pre-modern world and this new volume traces the history of this magnificent empire from its creation in 1526 to its breakup in 1720. more...
Democracy, Development, and the CountrysideCambridge University Press 1998; US$ 24.00 US$ 19.68
This book examines how the rural sector in India uses its numbers in a democracy to further its economic and political interests. more...
Florence Nightingale's Spiritual Journey: Biblical Annotations, Sermons and Journal NotesWilfrid Laurier University Press 2006; US$ 95.00
Florence Nightingale (1820-1910) is widely known as the heroine of the Crimean War and the founder of the modern profession of nursing. She was also a scholar and political activist who wrote and worked assiduously on many reform causes for more than forty years. This series will confirm Nightingale as an important and significant nineteenth-century... more...


text:
The 5 Best Instant Messenger Clients for Ubuntu
What is the best IM (Instant Messaging) Client for Ubuntu? Let's find out!
Pidgin is the default messaging client for Ubuntu and comes pre-installed.
One of Pidgins strongest selling points is its support for a multitude of various different IM protocols - a selection of which are: MSN, Yahoo, AIM, Gtalk and even IRC! Uniquely, with Pidgin you can log in to multiple accounts simultaneously. This means that you can be chatting with friends on AIM, flirting with contacts on Yahoo! - all whilst nattering away to your MSN buddies - all at the same time.
Pidgin supports the usual IM features such as file transfer, customised status/nick names, away messages and typing notification.
'Simple' and 'Clean' are two words i would use to describe Pidgin's interface.
- Login or register to post comments
- Printer-friendly version
- PDF version
More in Tux Machines
- Highlights
- Front Page
- Latest Headlines
- Archive
- Recent comments
- All-Time Popular Stories
- Hot Topics
- New Members
Security Leftovers
10 hot Android smartphones that got price cuts recently
With numerous smartphone getting launched each month, brands always adjust prices to give slightly competitive edge to older smartphone models and also to clear inventories. Here are 10 smartphones that got price cuts recently.
Debian and Ubuntu News
Tablet review: BQ Aquaris M10 Ubuntu Edition
As employees have become more and more flexible in recent years thanks to the power and performance of mobile devices, the way we work has changed dramatically. We frequently chop and change between smartphones, tablets and laptops for different tasks, which has led to the growth of the hybrid market – devices such as Microsoft's Surface Pro 3 and Apple's iPad Pro – that provide the power and functionality of a laptop with the mobility and convenience of a tablet.


text:
Crash causes SB lanes on Turnpike in Osceola County to shut down
Updated:OSCEOLA COUNTY, Fla. —
The southbound lanes of the Turnpike in Osceola County are shut down due to a crash near the Osceola County Parkway ramp Wednesday, said WFTV traffic reporter Racquel Asa.
Asa advises drivers to use US-192 to Michigan Avenue NB to connect to the Osceola Parkway as an alternate route.
Crash causes SB lanes on Turnpike in Osceola County to shut down
UPDATE: 2 lanes closed on I-95 N near Viera after crash
Off-duty firefighters pull victims out of fiery SUV on I-95 in Brevard County
West lanes of 436 in Altamonte Springs back open after head-on crash
Not clear if victim of Apopka drive-by shooting was targeted, deputies say


text:
Originally posted on MyTeamRivals.com | Last updated 9/8/12
Coming off a season full of injuries to key players through out the season the Houston Texans are looking to build on what they were still able to accomplish even without the franchises all time leading passing yards leader, receiving yards leader, and all time rushing leader. Also take into account the fact we lost 1 game with new defensive coordinator Wade Phillips sidelined after surgery to a Panthers team, at home. A team the Texans are more than capable of beating. In the following week , also without Phillips on the sideline the Texans lost to the Indianapolis Colts. And to finish off the regular season coach Gary Kubiak rested starters knowing there was no ground to gain in the playoffs and figured why chance it. In that game the second team basically took it to the wire, going for 2 to win the game instead of taking it to overtime at home against a Titans team that was fighting for a playoff spot themselves. Now do not take this wrong I'm not saying by any means that they ha...
NFL News
Delivered to your inbox
You'll also receive Yardbarker's daily Top 10, featuring the best sports stories from around the web. Customize your newsletter to get articles on your favorite sports and teams. And the best part? It's free!
Follow us on Twitter
|Best of Yardbarker
|NFL News
|MLB News
|NBA News
|NHL News
Today's Best Stuff
For Publishers
Company Info
Follow Yardbarker
|© 2016 Yardbarker, Inc. All rights reserved. Use of this website (including any and all parts and components) constitutes your acceptance of these Terms of Use and Privacy Policy. (What's New?)


text:
G4S Global Aviation Solutions Director, David Stockton will present on the subject of Manpower & Technology to Technology & Manpower at the summit, outlining a wide range of innovative service delivery models, from virtual check ins, to automated transfer & boarding, to integrated journey management. The session will address the opportunities and challenges behind embracing such technology practices in the world of aviation.
"Our aviation footprint spans across 45 countries, with presence at over 120 airports and providing services to 85 of the world's leading airlines. The region with its burgeoning economy and aviation sector comprises some of our most important markets globally. Our presence at Intersec is to re-emphasize our experience and technological advanced solutions in the field and explore opportunities to share this with partners across the region," said Chris Fergus, G4S Regional Managing Director - Middle East.
"Owing to our global expertise in the sector, Aviation Security is an integral part of our UAE vision. We have been associated with the Abu Dhabi and Dubai Airports since 2008 and contribute to both these locations more than 700 of our personnel on a daily basis across various functions including customer service and boarding pass scanners. With the introduction of more local airlines and new airports, the UAE aviation sector is a headline focus for us at G4S," said Mohamed Ezeldin, Managing Director, G4S - UAE.
G4S is headquartered in the UK and operates in more than 120 countries and over 625,000 employees. Dubbed as the largest employer by the London Stock Exchange, G4S has an additional stock exchange listing in Copenhagen. The company services 11 countries across the Middle East by providing Manned Security Solutions, Security Systems, Cash Solutions and Facilities Management, offering a trusted service to thousands of international, regional and local customers.
G4S began its UAE venture in 1994 and today is the only security company with a complete national footprint with 11 offices in Abu Dhabi, Dubai, Al Ain, Sharjah, Ajman, Al Fujairah, RAK, and Um-Al Quwain. With strength in excess of 10,000 employees providing services to almost all the industry sectors including government, retail, banking, shopping malls, events and airports, G4S is the UAE's leading total security solutions provider.
About G4S G4S is the largest security services provider in the world, with operations in more than 125 countries across six continents. The Group offers a wide range of secure solutions and business processes, including secure facilities management, security consultancy, event security, secure transport services, security systems and security services to governments. G4S provides services to public, private and corporate customers. G4S plc is a FTSE 100 listed company, and is also listed on the Copenhagen Stock Exchange. In 2010, the Group had a turnover of £7.4 billion. With over 625,000 employees G4S is the largest employer on the London Stock Exchange. G4S was formed from the merger between Securicor plc and Group 4 Falck A/S's security business, which completed in July 2004.
For more details please contact:firstname.lastname@example.com
© Press Release 2012
© Copyright Zawya. All Rights Reserved.


text:
You are a fan of site higher ? Come to discover the best forums site higher on the internet and share your experience with a community fan of site higher . You can also build a forum site higher and create your online discussion.
Sleuthing and Spoilers A site for fans of The Bachelor & Bachelorette who enjoy sleuthing and discussing spoilers for this show and others!
bachelor, spoilers, bachelorette, sean, lowe, higgins, kaitlyn, nick, shawn, andi, dorfman, catherine, desiree
A Jef Holm & Emily Maynard fan site
A place for Percy Jackson and the Olympians fans to roleplay.
percy, jackson, demigod, camp, half, blood, forumotion, olympus, forum, fanfiction, #site
Free forum : Discuss, find new anime, role play, and enjoy your favorite anime here.
free, forum, anime, #site, discuss, find, role, play, enjoy, your, favorite, here
This site is for our HATR FAMILY to come to and visit with other Friends and Family. We are all about enjoying the outdoors. Hunting Target Shooting, Gun Collecting
home, range, this, #site, hatr, family, come, visit, with, other, friends, about, enjoying, outdoors, hunting, target, shooting
Sports Card Trading Site
A site for the roleplaying of the all time favorite anime, Soul Eater
free, forum, soul, eater, roleplay, #site, roleplaying, time, favorite, anime
A story based site in an alternate universe to the original Kingdom Hearts, taking place 20 years after the Birth By Sleep era.
kingdom, hearts, mirage, arena, #site, birth, sleep, forum, khrpg, mhrpg, role, play
A roleplay forum based on the Log Horizon series! A laid back, freeform site for those who want to relax and have fun.
Welcome to The Nintendo Forum Site!
pokemon, nintendo, forum, #site, mario, kirby, pokémon, fire, emblem, pikmin, zelda, legend, forums, zero, revolution, fluffiness~, gameguy, cubone
WiiWareWave is a rapidly growing Nintendo fan site with the latest Nintendo news updates, game reviews and an active forum to chat about Nintendo.
nintendo, forum, dsiware, wiiware, virtual, console, mario, luigi, zelda, pokemon, metroid, ninty, game, gaming
After the destruction of the multiverse, Portal Breach was created to be a safe haven for those that survived and managed to make their way here. Join us as any canon or original character!
roleplay, portal, breach, collision, worlds, cartoon, crossover, roleplaying, #site, role-playing, role, playing, play, role-play
Official Site of Aegean Eagles. Aegean Eagles' Forum
aegean, eagles, lotro, kinship, evernight, deeping, wall, raid, guide, lotr, mmorpg
RP as a warrior cat on this blooming site! We're a fun group of people looking to role play
forum, leaping, warrior, cats, warriors, rolyplay, erin, hunter, forums
Online Gaming Community for COD4 Enthusiasts.
At HCLC, we are Building Faith in Every Home. This site connects you to resources and community support from others who are building a faithful home. Welcome!
hclc, online, connections, portal, building, faith, #site, connects, resources, community, support, faithful
Greyknight fan site for table top gameing This order of light is dedicated to the way of the emperor and to stamp chaos in to dust
grey, knights, daemonhunters, malleus, warhammer, space, marines, inquisition, sisters, battle, dawn, soul, storm
Free forum : This is a Non-Canon AU Weyr site the 6 canon colors are included as well (white is canon to me), things to do with Earth is included
halloween, weyr, non-canon, #site, canon, colors, earth, involved, clutches
This cant be blank
Free forum : An RP site where the five Warrior Clans live together before the Erin Hunter warrior series. Hunt, Battle, Create and Play with others. Your path is in your paws.
clan, cats, #site, warrior, clans, live, erin, hunter, series, hunt, battle, play, path
The goal of this site is to promote, inform, and create a community for those just discovering Hellenismos, those with interest, and those who have been practicing for an extensive amount of time.
greek, olympianismos, hellenism, olympianism, hellenismos, ancient, gods, roman, religio, romana
This is a site for a WWTA IRC game with some house rules to spice things up.
Largest Sonic fan site/fan forum on Forumotion. Created and founded by Sega of America members. The
sonic, forum, #site, news, fansite, community, game, gaming, games, tescia, soni
This site is an alternative to the other mundane golf forums. We've got a personality here. We talk everything golf and occasionally things that have nothing to do with golf. This site is not for t
caddy, shack, this, #site, alternative, other, mundane, golf, forums, we've, personality, here, talk, everything, occasionally, things, that, have, nothing
pokemon fan page for pokemon fans
A roleplaying site dedicated to the Fable video game franchise!
fable, tale, heroes, roleplaying, #site, dedicated, video, game, franchise!
This site is for those part of the Hero clan on Pokémon Online.
free, forum, hero, clan, forum!, this, #site, those, part, pokemon, online
The rebirth of the Pokemon Dream League that was once a popular site, now it's time to make it what it once was and more. A community dedicated to competitive gaming and fan art. We'll
gaming, dream, league, uprising, rebirth, community, pokemon, that, once, popular, #site, it's, time, make, what, more
Downline Promotion Site/Forum, Sign up to the sites that are proven to pay! just look in the payment proof section, for peace of mind, Create your Downline from one page + get great tips on how to com. . . .
paypal, amazon, gptsites, instant, serve, cash, check, workfromhome, home, money, online, forum, 2013, easy, poker, dollar, dollars, survey, surveys, referr