compare two lists

It is very easy to compare two lists in python, but it seems not so many people know it.

Just use the `==` symbol in numpy, it will return a numpy array with boolean value, True means the position are idential.

import numpy as np

aa = [“a”,”b”,”a”]
bb = [“b”,”b”,”a”]


>>array([False, True, True], dtype=bool)

see my example code in stackoverflow:

Written by connygy. Posted in Uncategorized

Trackback from your site.

Leave a comment