Python Keylogger Tutorial - 3 - 'with' keyword in Python

Veröffentlicht am: 02 Januar 2019
auf dem Kanal: buildwithpython
21,988
342

In the previous video we learned that whenever we use the open function it allocates some resources and memory to the file. And after we use the close function it releases the resources from the system. If we don't realease this memory it might give us some errors. So it's always a good practice to close the file.

Now this memory allocation and then it's release is used not only in file handling but in other kind of things as well. For example, listeners. We will be using these listeners to listen to keystrokes in future videos. But for now just understand that this listener also requires some memory allocation and then after the listener has done it's job we have to release the resources.

Now the function of the 'with' keyword is that it releases the memory automatically. So if use the 'with' keyword we won't have to type in the close function. So let's actually to that.

Now this might seem small of a change to you but when are writing a lot of code sometimes you might forget to release the resources. And this will create a lt of problems. Or if you are using something like listeners in which you don't really know when you are supposed to release the resources the 'with' keyword comes in pretty handy.

Full Playlist -    • Building a keylogger using Python + Pynput  
Source Code - https://github.com/attreyabhatt/Pytho...

Subscribe -    / @buildwithpython  
Website - www.buildwithpython.com
Instagram -   / buildwithpython  

#python


Auf dieser Seite können Sie das Online-Video Python Keylogger Tutorial - 3 - 'with' keyword in Python mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer buildwithpython 02 Januar 2019 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 21,988 Mal angesehen und es wurde von 342 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!