itertools.combinations

Generates all possible combinations of elements of a specified length:

C(5,2)C(5,2)

1
2
3
4
5
6
import itertools

str = ['A', 'B', 'C', 'D', 'E']
# Compute combinations of length 2 without replacement
combinations_result = list(itertools.combinations(str, 2))
print(combinations_result)

The output is as follows:

Read more »

Installation and Import of OpenCV in Python

Execute the following pip command to complete the installation of the OpenCV library:

1
pip install opencv-python

After the installation is complete, import the cv2 module:

Read more »

Install NexT Theme

First, you need to install the NexT theme, you can enter the following code:

1
npm install hexo-theme-next

Read more »
0%