Friday, February 1, 2013

Introduction to Python for Beginner


Python is a dynamic interpreted object oriented scripting language. Python can execute in 2 modes. There are, Interactive mode using the terminal or command prompt and  scripting mode using “.py”  file. The most powerful advantage in python is source code does not declare the types of variables or parameters or methods. According to your syntax of initializing of variable, compiler understand the variable is which type. So codes are more flexible and short. Other important thing is, there no “{}”  to define indentation. Indentation takes place by tab spacing. Be careful when coding you have to maintain the indentation correctly. If you unable to maintain the indentation correctly, your Programming may execute different way. Now I think you have the background knowledge. So let’s begin with installation.

Installation
You can download in here. If you are using CentOS , it comes with python 2.6 version. In Linux terminal
You can find the python installed location by command “ whereis python”.




You have to set the Environmental PATH variable.
If you are programming with terminal you have to convert  to the python interpreter by typing “python” command.




To terminate the Python we should use Ctrl + D.

Install Eclipse plugin for Python


If you are using IDE ,You have to use plugin for python. Let me describe it using Eclipse IDE.
1.Open Eclipse IDE à Help in menu bar à Eclipse Marketplace.


2.Type “pydev” in find field and click go. Then click the “Install” button in “ PyDev – Python IDE for Eclipse”.








3.Click Window in menu bar-à Preferences àPyDevàInterperter- PythonàNew.





5.Give any name as “Interpreter Name” and Browse where the  python executable file(python.exe) is to “Interpreter Executable” and OK  .If it found the executable file It will show you.Then click OK.





6.Then to open the perspective, WindowàOpen Perspective à Other àPyDevàOK.




Now Environment is ok.
First you have to create a project.
File à New àPyDev Project àGive a project name. àFinish.





Then you have to make a new python file.
Select the project àNew à Fileàtype a file name with “.py ”extention. à Finish.



This is the time for coding.get your hands dirty with coding.

No comments:

Post a Comment

The Hypervisor

 The hypervisor is a piece of software that runs on top of hardware infrastructure that creates a virtualization platform. The hypervisor a...