-4

Example program,

1.

while True:
   sucess, image = cv2.imshow(img)
while True:
   _,frame = cv2.imread()

what does the syntax mean? what do they mean by assigning two variables for one value? is sucess some inbuilt command?

4
  • it probably means that the method returns two values oh and the _ tells python that that variable is not needed so it gets garbage collected or sth Commented Jul 22, 2021 at 19:42
  • It's called tuple unpacking. It's the same as name, age = 'Bob', 45. Commented Jul 22, 2021 at 19:45
  • 1
    The unpacking is nothing to do with the while True. Commented Jul 22, 2021 at 19:45
  • _ is a standard practice to indicate the variable is not used. Commented Jul 22, 2021 at 19:45

2 Answers 2

0
a,b = c

That syntax means that c is expected to be a sequence of two values. The first value is assigned to a, and the second value is assigned to b.

Sign up to request clarification or add additional context in comments.

1 Comment

In How to Answer, note the Answer Well-Asked Questions section, and therein the bullet point regarding questions that "have been asked and answered many times before".
0

This means cv2.imread() and cv2.imshow() return a tuple. There can be other way to get result.

result = cv2.imread()
succes = result[0]
image = result[1]

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.