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

Publicado el: 02 enero 2019
en el canal de: 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


En esta página del sitio puede ver el video en línea Python Keylogger Tutorial - 3 - 'with' keyword in Python de Duración hora minuto segunda en buena calidad , que subió el usuario buildwithpython 02 enero 2019, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 21,988 veces y le gustó 342 a los espectadores. Disfruta viendo!