Skip to content

Tag: python

Destructor usage in python __del__()

Will the following not cause issue of freeing memory twice? Why is python3 destroying an object when it has already been destroyed by the programmer? Output: Answer By calling __del__() you’re just calling a method on the instance, without any special meaning. The __del__() method, both yours and by def…

Sympy calculation on tan function

I have a problem when simplifying a symbolic expression in sympy when having a trigonometric function and a complex exponent, namely I just assumed a different definition of tan function, and I have a weird thing going on. So I do: Symbolic variable sym.simplify(test2) is equal to -tan(a) and normaly test1 va…

how to match the keys of a dictionary and return their values?

I have two dictionaries: Both dictionaries contains the same amount of key_value pairs. In dictionary x, the key is the translation in Bulgarian of names of languages and the values are the names of the same languages in English. in dictionary y, the keys are the name of the languages in Bulgarian and the val…

NameError: name ‘VideoCapture’ is not defined [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 11 …

How to take a screenshot from part of screen with mss python?

I have a simple code here: result.png But I want to take a part of screen like this: Thanks for help! Answer As explained on https://python-mss.readthedocs.io/examples.html, something like this should work: This is just the example given on the website. You can adjust the part of the screen that you are takin…