Build your python project using ZEROMQ Super fast,distributed and infinetely scalable

A quick start video for ZeroMQ – Super fast,distributed and infinetely scalable

Source : python India youtube channel

Advertisements

Google App Engine for Python – part 2

Google App Engine for Python Part 2 – Deploying

Quick description:

This video will explains about how to deploy/host your python application into internet using google app engine. Once you application is hosted in internet, it can be run from anywhere using the “appname.appspot.com”  whereas appname is your application name.

Example: Say app name is “sample”, then the final url will be sample.appspot.com

Please read the above paragraph before watching the video

Source: Stefano Locati youtube video

Google App Engine for Python – Part 1

Google App Engine for Python Part 1- Hello World

Quick description:

This video will explains about how to deploy/host your python application into local machine. After the application hosting, it can be run by typing the following command on your web browser “localhost:portnumber” whereas port number is one which you set during the application creation

Example: localhost:8080

Please read the above paragraph before watching the video

A quick start video for start working in Google app engine using python

I have come across very easily and quickly understandable short video on Google App Engine for Python

Source: Stefano Locati youtube video

What is the REPL?

A read–eval–print loop (REPL), also known as an interactive toplevel or language shell, is a simple, interactive computer programming environment that takes single user inputs (i.e. single expressions), evaluates them, and returns the result to the user; a program written in a REPL environment is executed piecewise.

Quick methods to add python Intrepreter into windows system path variable

All three methods are tested and it is working in all versions of windows OS.

Method 1:

  1. Hold down windows key and press pause key.
  2. Click Advanced System Settings.
  3. Click Environment Variables.
  4. Append ;C:\python27 to the Path variable

Method 2:

Setting path at Windows

To add the Python directory to the path for a particular session in Windows −

In command prompt − type path %path%;C:\Python and press Enter.

Note − C:\Python is the path of the Python directory

Python Environment Variables

Here are important environment variables, which can be recognized by Python −

S.No. System Variable & Description
1 PYTHONPATH

It has a role similar to PATH. This variable tells the Python interpreter where to locate the module files imported into a program. It should include the Python source library directory and the directories containing Python source code. PYTHONPATH is sometimes preset by the Python installer.

2 PYTHONSTARTUP

It contains the path of an initialization file containing Python source code. It is executed every time you start the interpreter. It is named as .pythonrc.py in Unix and it contains commands that load utilities or modify PYTHONPATH.

3 PYTHONCASEOK

It is used in Windows to instruct Python to find the first case-insensitive match in an import statement. Set this variable to any value to activate it.

4 PYTHONHOME

It is an alternative module search path. It is usually embedded in the PYTHONSTARTUP or PYTHONPATH directories to make switching module libraries easy.

Method 3:

  1. [Right Click]Computer > Properties >Advanced System Settings > Environment Variables
  2. Click [New] under “System Variable”
  3. Variable Name: PY_HOME, Variable Value:C:\path\to\python\version enter image description here
  4. Click [OK]
  5. Locate the “Path” System variable and click [Edit]
  6. Add the following to the existing variable:

    %PY_HOME%;%PY_HOME%\Lib;%PY_HOME%\DLLs;%PY_HOME%\Lib\lib-tk; enter image description here

  7. Click [OK] to close all of the windows.

As a final sanity check open a command prompt and enter python. You should see

>python "type version"

If you need to switch between versions, you only need to modify the PY_HOME variable to point to the proper directory. This is bit easier to manage if you need multiple python versions installed.

Dictionary .get method usage in python

Description

The method get() returns a value for the given key. If key is not available then returns default value None.

Syntax

Following is the syntax for get() method −

dict.get(key, default=None)

Parameters

  • key — This is the Key to be searched in the dictionary.
  • default — This is the Value to be returned in case key does not exist.

Return Value

This method return a value for the given key. If key is not available, then returns default value None.

Example

The following example shows the usage of get() method.

#!/usr/bin/python

diction = {'Name': 'Kumar', 'Age': 12}

print "Value : %s" %  diction.get('Age')
print "Value : %s" %  diction.get('School', "Nothing")

When we run above program, it produces following result −

Value : 12
Value : Nothing