Home > Net >  Empty image as class variable
Empty image as class variable

Time:06-27

I want to declare an image as a class variable in order to use it with different method.

Is frame = None an acceptable way in python? Otherwise what is the best way?

Regards,

CodePudding user response:

If you create a variable frame and set its value to None. You can later assign it any other value that you need, for example, a class as your program requires.

class A:
    def __init__(self):
        self.a = 1

frame = None
frame = A()
print(frame)

Output:

<__main__.A object at 0x7fdfff4804c0>
  • Related