python saving a screentshot with PIL

#python 3
from PIL import ImageGrab 
snapshot = ImageGrab.grab()
save_path = "C:\\Users\\YourUser\\Desktop\\MySnapshot.jpg" #dont forget to write the name and the extension of the file in the end
snapshot.save(save_path)

Here is what the above code is Doing:
1. We are importing the ImageGrab module from the PIL library.
2. We are creating a snapshot variable and storing the image in it.
3. We are creating a save_path variable and storing the path of the file where we want to save the snapshot.
4. We are using the save() method to save the snapshot in the file we specified in the save_path variable.