Servlet NewJavaServlet Test



Yüklə 11,16 Mb.
Pdf görüntüsü
səhifə3/97
tarix07.11.2018
ölçüsü11,16 Mb.
#78896
1   2   3   4   5   6   7   8   9   ...   97


 CONTENTS  
 
vi 
Other Python Statements ................................................................................................................. 21

Documenting Code........................................................................................................................... 22

Python Help ..................................................................................................................................... 23

Summary ......................................................................................................................................... 24

■ 
Chapter 2: Data Types and Referencing .......................................................................................25 
Python Data Types ........................................................................................................................... 25

Strings and String Methods.......................................................................................................... 27

String Formatting..................................................................................................................... 31

Lists, Dictionaries, Sets, and Tuples............................................................................................. 33

Lists ........................................................................................................................................ 33

List Comprehensions ............................................................................................................... 40

Tuples ..................................................................................................................................... 41

Dictionaries ............................................................................................................................. 42

Sets ......................................................................................................................................... 45

Ranges .................................................................................................................................... 48

Range Format .......................................................................................................................... 49

Jython-specific Collections .......................................................................................................... 50

Files............................................................................................................................................. 52

Iterators ....................................................................................................................................... 54

Referencing and Copies ............................................................................................................... 55

Garbage Collection....................................................................................................................... 57

Summary ......................................................................................................................................... 58

■ 
Chapter 3: Operators, Expressions, and Program Flow ...............................................................59
 
Types of Expressions ....................................................................................................................... 59

Mathematical Operations ................................................................................................................. 59

Comparison Operators ................................................................................................................. 63

Bitwise Operators ........................................................................................................................ 65

Augmented Assignment ............................................................................................................... 66

Boolean Expressions .................................................................................................................... 68

Conversions ................................................................................................................................. 70

Using Expressions to Control Program Flow...................................................................................... 72

if-elif-else Statement ................................................................................................................... 72

while Loop ................................................................................................................................... 73

continue Statement...................................................................................................................... 74

break Statement .......................................................................................................................... 75

www.it-ebooks.info



 CONTENTS  
 
 
 
vii 
for Loop ....................................................................................................................................... 76

Example Code.............................................................................................................................. 77

Summary ......................................................................................................................................... 79

■ 
Chapter 4: Defining Functions and Using Built-ins ......................................................................81
 
Function Syntax and Basics.............................................................................................................. 81

The def Keyword.......................................................................................................................... 82

Naming the Function.................................................................................................................... 82

Function Parameters and Calling Functions.................................................................................. 84

Recursive Function Calls .......................................................................................................... 86

Function Body.............................................................................................................................. 86

Documenting Functions ........................................................................................................... 86

Returning Values...................................................................................................................... 87

Introducing Variables ............................................................................................................... 88

Other Statements..................................................................................................................... 89

Empty Functions ...................................................................................................................... 89

Miscellaneous Information for the Curious Reader............................................................................ 90

Built-in Functions............................................................................................................................. 90

Alternative Ways to Define Functions ............................................................................................... 90

Lambda Functions ....................................................................................................................... 91

Generator Functions......................................................................................................................... 91

Defining Generators ..................................................................................................................... 92

Generator Expressions ................................................................................................................. 95

Namespaces, Nested Scopes, and Closures ..................................................................................... 95

Function Decorators......................................................................................................................... 96

Coroutines ....................................................................................................................................... 99

Decorators in Coroutines............................................................................................................ 101

Coroutine Example..................................................................................................................... 102

Summary ....................................................................................................................................... 102

■ 
Chapter 5: Input and Output........................................................................................................105 
Input from the Keyboard................................................................................................................. 105

sys.stdin and raw_input............................................................................................................. 105

Obtaining Variables from Jython Environment ............................................................................ 106

File I/O ........................................................................................................................................... 107

Pickle............................................................................................................................................. 110

Output Techniques..................................................................................................................... 111

www.it-ebooks.info


Yüklə 11,16 Mb.

Dostları ilə paylaş:
1   2   3   4   5   6   7   8   9   ...   97




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©www.genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə