Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Format Q
#1
Hi,

What's the difference between these two codes? Does one run faster than the other or it's just a question of correct format?

TIA

# Import modules
from picamera import PiCamera
import time

if __name__ == '__main__':
    # Instantiate PiCamera object
    camera = PiCamera()

    # Sleep for 5 seconds before taking the photo
    time.sleep(5)

    # Take photo and save it as 'test.jpg'
    camera.capture('./test.jpg')
# Import modules
from picamera import PiCamera
import time

# Instantiate PiCamera object
camera = PiCamera()

# Sleep for 5 seconds before taking the photo
time.sleep(5)

# Take photo and save it as 'test.jpg'
camera.capture('./test.jpg')
Reply


Messages In This Thread
Format Q - by ebolisa - Jan-16-2020, 05:32 PM
RE: Format Q - by micseydel - Jan-16-2020, 06:05 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020