Definition when print(s) stops writing Python



  • Hello, everyone! I had a question about the print(s) at Python. For one thing, I need to perform a function that needs to be determined when it stops writing. Please tell me. The best I've ever thought of is:

    eyes2 = cv2.rectangle(img, (x+ex, y+ey), (x+ex + ew, y+ey + eh), (255, 0, 0), 2) # тут выдает значение, а я его компилирую yes
    if eyes2.any():
       success2221 = "yes"
       success222 = print(success2221)
    if 'yes' in success222:
       print('Есть такой текст')
    if 'no' in success222:
       print('Нет такого текста')
    

    Please help me!



  • I finally understood the question. The problem is, print() returns None

    print() Always returning. None Anyway,

    success2221 = "yes"
    success222 = print( success2221 ) # тут выводится yes
    print( success222 )               # тут печатается None
    

    There are functions that return value, such as the square root, and there are functions that never return anything as a result (they just do something and they don't return anything). If you do your job and you don't return anything. result, so Python's adding to the code. result = None♪ Same as in the functions print() It says result = None

    So no matter what. print() the result

    print( print( '' ) ) Always. None



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2