in the following code snippet:
import cv2 for color_space in (cv2.COLOR_RGB2HSV, cv2.COLOR_RGB2LUV, cv2.COLOR_RGB2HLS, cv2.COLOR_RGB2YUV, cv2.COLOR_RGB2YCrCb): *print_it_as_name(color_space)* With which real statement can I replace print_it_as_name such that the output is
cv2.COLOR_RGB2HSV cv2.COLOR_RGB2LUV cv2.COLOR_RGB2HLS cv2.COLOR_RGB2YUV, cv2.COLOR_RGB2YCrCb
Without hardcoding it using if statements?
''? If you want to work with variables dynamically you can always use their names as strings and obtain the corresponding values viagetattr.