How to Install Eclipse

                  How to Install Eclipse


Go Through this Link 

Click HERE Download Eclipse



pydev20
Press finish.

Window Open Perspective Select Other. Select the PyDev perspective.

pydev30
Select the "src" folder of your project, right-click it and choose New → PaiDev module. Create a module "FirstModule".

pydev40
pydev50
Create the following source code.

''
Created on 18.06.2009

@Kathor: Lars Vogel
''
Diff Add (A, B):
Return + a

Add fixdvalue (A):
Y = 5
Return y + a

Add Print (1,2)
Print EdfixDue (1)
Right-click on your model and choose Run as → Python Run.

pydev60
congratulation! You created and ran your first (slightly) Python module!

4. Debugging
Just right-click in the source code and add a breakpoint.

debug10
Then select → debit as python run

debug20
Now you can inspect and modify variables in variable view.

debug30
You can go to your program via the debug button (or shortcuts F5, F6, F7, F8).

You can use F5 / F6, F7 and F8 to step through your coding.

Table 1. Debugging key bindings
Command statement
F5

Goes to the next stage in his program. If the next step is a method / task then this command will jump to the corresponding code.

F6

F6 will step on the call, e.g. It will call a method / function without entering the corresponding code.

F7

F7 will go to the method / function caller. Then it will leave the current code and go to the calling code.

F8

Use F8 to move to the next breakpoint. If no further breakpoint is found, the program will run normally.

You can definitely use the UI to debug. The following displays the key bindings for the debug button.

debug40
5. Programming in Python
5.1. notes
The following single lines form the comment.

# This is a comment
5.2. Variable
Python provides dynamic typing of its variables, e.g. You do not need to define a type of variable Python will take care of that for you.

# This is a text
s = "Lars"
# This is an integer
x = 1
y = 4
z = x + y
5.3. Claims like this
Python provides assertiveness. These claims are always called.

Emphasis (1 == 2)
5.4. Methods / Functions in Python
Python allows methods to be defined through the definition of keywords. As the language is interpreted, methods need to be defined before it can be used.

Diff Add (A, B):
Return + a

Add Print (1,2)
5.5. Loops and if clauses
The following uses a loop if-clause use.

I = 1
I in range (1, 10):
If i <= 5:
Print 'small or more than 5 \ n',
other:
5. Print larger than '\ n',
5.6. String manipulation
Python allows the following string operations.

Table 2. String Operations
Operation details
Lane (s)

Returns the length of string s

S [i]

String i has an element at position i, position starts at zero

S [i]

Get the i-tes sign of the string from the back of the string, e.g. -1 returns the last element in the string

"Abcdefg" [0: 4]

The first 4 elements meet (abcd)

"Abcdefg" [4:]

Gets the elements after the first 4 elements (abcd)

a + b + c

Context to int variables a, b, c, e.g. If a = 1, b = 2, c = 3, the result is 123.

Slower()

The result will be in the following cases

s.upper ()

The result will be upper case

s.startswith (t)

True, if t begins with

s.rstrip ()

Removes end of line sign from string

for example:

s = "abcdefg"
Vocal (s [0: 4] == "abcd")
Vocal (s [4:] == "efg")
Vocal ("abcdefg" [4: 0] == "")
Vocal ("abcdefg" [0: 2] == "ab")
5.7. Continent strings and numbers
Python does not allow to straighten a string with a number. This requires you to convert the first number to a string with the string () function.

If you do not use str (), you cannot find "TypeError: 'str' and 'int' objects.

for example:

Print 'This is a text plus a number' + str (10)
5.8. Lists
Python has good support for lists. See the following examples of how to create a list, how to use individual elements or sub-lists, and how to add elements to a list.

''
Created on 14.09.2010

@Kathor: Lars Vogel
''
mylist = ["Linux", "Mac OS", "Windows"]
# Print the first list element
Print (MyList [0])
# Print the last element
# Negative expressions start the list from the end
Print (MyList [-1])
# Sublists - First and Second Elements
Print (MyList [0: 2])
# Add element to list
mylist.append ("Android")
# Print the contents of the list
For the element in mylist:
Print (element)
If you want to remove a duplicate from a list, you can use:

mylist = ["Linux", "Linux", "Windows"]
# Remove duplicate from list
mylist = list (set (mylist))
5.9. Processing files in python
The following example is contained in the project "de.vogella.python.files". The following reads a file, strips the end of the line sign and prints each line on the console.

''
Created on 07.10.2009

@Kathor: Lars Vogel
''

f = open ('c: \\ temp \\ wave1_new.csv', 'r')
Print f
For the line in F:
Print line. Strip ()
f.close ()
The following reads the same file but writes the output to another file.

''
@Kathor: Lars Vogel
''

f = open ('c: \\ temp \\ wave1_new

Post a Comment

0 Comments

Search This Blog