KEMBAR78
Python Orientation | PDF
This presentation cannot be shared unless the course is completed. The slides can be
shared by the course provider end of the session only.

1
2
Gives a brief overview of the Python programming. Describe the major focus of the
presentation and why it is important.
Introduce each of the major topics.
To provide a road map for the audience, you can repeat this Overview slide
throughout the presentation, highlighting the particular topic you will discuss next.

3
4
https://wiki.python.org/moin/WebFrameworks

5
WEBSERVICES PYTHON – SOA
• http://www.pythomnic3k.org/tour-resources.html
• http://pyvideo.org/speaker/377/jessica-mckellar
• http://flask.pocoo.org/
• http://www.oracle.com/technetwork/articles/dsl/mastering-oracle-python1391323.html

6
Qt Cross platform framework (Win/Mac/X11, soon S60)
Native look and feel
Modular (Core, GUI, Network, OpenGL, SQL, WebKit, etc)
Mature Internationalization
Excellent documentation
Available under both commercial and Open Source licenses

7
This is another option for an Overview slides using transitions.

8
9
10
11
The purpose of this presentation is to make the case for three technologies ... (see
next slide)

12
13
There is no standard definition of "scripting language", but this set of criteria pretty
much captures what most people mean by the term.
Note that Java is interpreted (it requires a JVM) but it is statically (strongly) typed and
requires a compilation step, so it is not a scripting language.

14
15
16
17
18
19
20
21
I got tired of cutting and pasting in pictures. This selection is possibly one-third of the
Python books on the market in May of 2003.
One way to judge the acceptance of a language is by how many O'Reilly books cover
it! Note that there are several O'Reilly books on this page, including "Python in a
Nutshell" (a VERY good book), and there are others not shown – "Learning Python" by
Lutz, the "Python Cookbook", etc.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
>>> a=[[1,2,3],[4,5,6],[7,8,9]]
>>> b=[[1,1,1],[1,1,1],[1,1,1]]
>>> a
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
>>> b
[[1, 1, 1], [1, 1, 1], [1, 1, 1]]
>>> c=[[0, 0, 0], [0, 0, 0], [0, 0, 0]]
>>> for i in range(3):
... for j in range(3):
...
c[i][j]=a[i][j] + b[i][j]
...
>>> c
[[2, 3, 4], [5, 6, 7], [8, 9, 10]]
Matrix in Python good references:
http://stackoverflow.com/questions/16541973/print-matrix-with-indicies-python

36
37
http://stackoverflow.com/questions/4877290/what-is-the-dict-dict-attribute-of-apython-class

38
39
40
41
42
43
44
http://software-carpentry.org/v3/py04.html

45
46
47
48
49
50
51
52
53
54
55
Bool
True = 1
False = 0

56
57
58
59
60
61
62
# Fibonacci
a, b = 0, 1
while b < 1000:
print b
a, b = b, a +b

63
64
What a function is
Defining a function in Python
Adding a docstring in Python
Function execution
Function Assignment
Return from function
Inner function
Default values of function parameters
Keyword argument
Lambda expression

65
http://www.c-sharpcorner.com/UploadFile/4aac15/python-basics-understanding-thefunctions/

66
67
http://www.c-sharpcorner.com/UploadFile/4aac15/python-basics-understanding-thefunctions/
def functionNameHere(parameters):
"""place your doc string here"""
#rest of the code.

68
69
70
71
Recursion is not a best practice for automations. Most preferred way is using loops

72
73
74
75
76
77
78
79
hi

bye

80
81
82
hi

bye

83
Try to see y value not having the string in the x.

84
This will help user when dealing with currency, Symbols, Specific Non English
Languages

85
86
87
The approach using string.Template is easy to learn and should be familiar to bash
users. It is suitable for exposing to end-users. This style became available in Python
2.4.
The percent-style will be familiar to many people coming from other programming
languages. Some people find this style to be error-prone because of the trailing "s"
in %(name)s, because the %-operator has the same precedence as multiplication, and
because the behavior of the applied arguments depends on their data type (tuples
and dicts get special handling). This style has been supported in Python since the
beginning.
The curly-bracket style is only supported in Python 2.6 or later. It is the most flexible
style (providing a rich set of control characters and allowing objects to implement
custom formatters).

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-189-agentle-introduction-to-programming-using-python-january-iap-2011/lectures/

111
112
113
Standard Python Modules
http://www.python.org/doc/current/modindex.html
PyPI: the Python Package Index :
third-party Python packages.
http://www.python.org/pypi

114
115
116
117
118
119
120
121
122
123
124
125
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
Because Python doesn't have (and doesn't need) a formal Interface contract, the
Java-style distinction between abstraction and interface doesn't exist. If someone
goes through the effort to define a formal interface, it will also be an abstract class.
The only differences would be in the stated intent in the docstring.
And the difference between abstract and interface is a hairsplitting thing when you
have duck typing.
Java uses interfaces because it doesn't have multiple inheritance.

146
147
148
Shape=type(“Shape”,(object,),{})
def area():
Rect=type(“Rect”,(Shape,),{l=2,b=4}

149
150
151
152
153
154
155
156
157
158
159
160
161
162
Greedy means match longest possible string.
Lazy means match shortest possible string.
For example, the greedy h.+l matches 'hell' in 'hello' but the lazy h.+?l matches 'hel'.

163
>>> s = ‘<a href=“index.html”>HERE</a><font size=“10”>’

164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
As you can see, the method split has two optional parameters. If none is given (or is
None) , a string will be separated into substring using whitespaces as delimiters, i.e.
every substring consisting purely of whitespaces is used as a delimiter.

181
182
ZIP
http://pythonprogramming.language-tutorial.com/2012/10/python-script-to-zip-andunzip-files.html

183
184
185
186
hi

bye

187
188
Remember that print >> automatically appends an end-of-line marker
Which is why the program above strips whitespace off the end of the string
before printing it

189
190
YouTube: TheMonkeyLords Tutorial: 24
>>> with open('c:/pbin/pystudent2/foo.txt','rt') as fin:
... print fin.read()
...
This is testing text file
new line
some more text

191
The whence argument is optional and defaults to os.SEEK_SET or 0 (absolute file
positioning);
other values are os.SEEK_CUR or 1 (seek relative to the current position) and
os.SEEK_END or 2 (seek relative to the file’s end).

192
http://pymotw.com/2/ospath/

193
The CSV (comma separated value) format is a common format used for spreadsheets
and databases, for importing and exporting of data. Each line or record in the file has
its fields separated by a delimiter, which can be a comma, tab, etc.

194
This is another option for an Overview slides using transitions.
http://zetcode.com/db/sqlitepythontutorial/
http://www.tutorialspoint.com/sqlite/sqlite_python.htm

195
196
197
198
This is another option for an Overview slides using transitions.

199
200
201
202
203
204
205
Set the path to this directory

206
207
208
209
210
PhoneNumberField, EmailField, URLField 같이 DB차원의 Low-level ….이 아닌
사용자입장에서 모델링 가능..
적절한 validation도 자동으로 됨

211
212
213
startproject
startapp
settings.py, urls.py
models.py 복사
manage.py syncdb
manage.py runserver
http://localhost:8000/admin/

214
215
216
217
218
219
220
221
222
This is another option for an Overview slides using transitions.

223
224
225
http://effbot.org/zone/element-index.htm

226
227
228
229
230
231
232
Add a case study or class simulation to encourage discussion and apply lessons.

233
Discuss outcomes of the case study or class simulation.
Cover best practices.

234
Microsoft Engineering Excellence

Microsoft Confidential

235
236
Microsoft Engineering Excellence

http://zetcode.com/db/sqlitepythontutorial/

Microsoft Confidential

237
Microsoft Engineering Excellence

Microsoft Confidential

238
You can contact us by email.

239
Microsoft Engineering Excellence

Presentation available on sildeshare and authorstream. Free to share it!

Microsoft Confidential

240

Python Orientation