how to capture a single photo with webcam opencv

cam = cv2.VideoCapture(0)

image =[1]

cv2.imshow("image", image)


Here is what the above code is Doing:
1. We import the OpenCV module and the numpy module.
2. We create a VideoCapture object.
3. We read the first frame from the webcam.
4. We display the image on the screen.
5. We wait for a key to be pressed.
6. We destroy all the windows.