Python_3
Python_3
nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
III 040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
֍ OOP’s Part – 3 ~~~~~~~~~~~~~~~~~~~~~~~~~ 58
⚽ Polymorphism ………………………………….……………………………………………………………….. 59
⚽ Duck Typing Philosophy of Python ………….…………………………………………………………. 59
⚽ Overloading ……………………………………………………………………..………………………………… 62
☕ Operator Overloading
☕ Method Overloading
☕ Constructor Overloading
⚽ Overriding ………………………………………………………………………………………………………….. 68
☕ Method Overriding
☕ Constructor Overriding
nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
V 040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
֍ Multi Threading ~~~~~~~~~~~~~~~~~~~~~~~ 123
⚽ Multi Tasking ………………………………………………………………………………………….… 124
☕ Process based Multi Tasking
☕ Thread based Multi Tasking
⚽ The ways of Creating Thread in Python ……………………………………………………… 125
☕ Creating a Thread without using any class
☕ Creating a Thread by extending Thread class
☕ Creating a Thread without extending Thread class
⚽ Setting and Getting Name of a Thread ………………………………………………………. 127
⚽ Thread Identification Number (ident) ………………………………………………………… 128
⚽ enumerate() Function ……………………………………………………………………………….. 129
⚽ isAlive() Method ……………………………………………………………………………………..… 130
⚽ join() Method ……………………………………………………………………………………………. 130
⚽ Daemon Threads ………………………………………………………………………………………. 132
⚽ Default Nature ………………………………………………………………………………………….. 133
⚽ Synchronization ………………………………………………………………………………………... 134
☕ Lock
☕ RLock
☕ Semaphore
⚽ Synchronization By using Lock Concept ……………………………………………………… 135
⚽ Problem with Simple Lock …………………………………………………………………….…… 136
⚽ Demo Program for Synchronization by using RLock …………………………………… 137
⚽ Difference between Lock and RLock ……………………………………………………..…… 138
⚽ Synchronization by using Semaphore ………………………………………………………… 138
⚽ Bounded Semaphore ………………………………………………………………………………... 140
⚽ Difference between Lock and Semaphore ……………………………………………….… 140
⚽ Inter Thread Communication ……………………………………………………………..……… 141
⚽ Inter Thread Communication by using Event Objects ………………………………… 141
⚽ Methods of Event Class ……………………………………………………………………………… 141
☕ set()
☕ clear()
☕ isSet()
☕ wait()|wait(seconds)
⚽ Inter Thread Communication by using Condition Object ………………………….… 143
nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
VI 040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
⚽ Methods of Condition ……………………………………………………………………………….. 143
☕ acquire()
☕ release()
☕ wait()|wait(time)
☕ notify()
☕ notifyAll()
⚽ Case Study ………………………………………………………………………………………………... 144
⚽ Inter Tread Communication by using Queue ……………………………………………… 146
⚽ Important Methods of Queue …………………………………………………………………… 146
☕ put()
☕ get()
⚽ Types of Queues ……………………………………………………………………………………….. 147
☕ FIFO Queue
☕ LIFO Queue
☕ Priority Queue
⚽ Good Programming Practices with usage of Locks ……………………………………… 148
nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
VII 040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
֍ Regular Expressions & Web Scraping ~~~~~~~~~ 166
⚽ Character Classes …………………………………………………………………………………….… 168
⚽ Pre defined Character Classes ……………………………………………………………………. 169
⚽ Qunatifiers ………………………………………………………………………………………………… 169
⚽ Important Functions of Remodule …………………………………………………………..… 170
1) match()
2) fullmatch()
3) search()
4) findall()
5) finditer()
6) sub()
7) subn()
8) split()
9) compile()
⚽ Web Scraping by using Regular Expressions …………………………………………….… 177
nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
VIII 040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com
֍ Python Logging ~~~~~~~~~~~~~~~~~~~~~~~ 193
⚽ Logging Levels …………………………………………………………………………………………. 194
⚽ How to implement Logging ……………………………………………………………………… 194
⚽ How to configure Log File in over writing Mode ………………………………………. 196
⚽ How to Format Log Messages ………………………………………………………………….. 196
⚽ How to add Timestamp in the Log Messages ……………………………………………. 197
⚽ How to Change Date and Time Format …………………………………………………….. 197
⚽ How to write Python Program Exceptions to the Log File …………………………. 198
⚽ Problems with Root Logger ……………………………………………………………………… 199
⚽ Need of Our Own Customized Logger ………………………………………………………. 200
⚽ Advanced logging Module Features: Logger …………………………………………….. 200
⚽ Logger with Configuration File …………………………………………………………………. 203
⚽ Creation of Custom Logger ………………………………………………………………………. 205
⚽ How to Create seperate Log File based on Caller ……………………………………… 206
⚽ Advantages of Customized Logger ……………………………………………………………. 208
nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
IX 040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com