python invert boolean code example
Example 1: set boolean to opposite python
go = True
go = not go
# go is now False
Example 2: how to invert a true false array in python
>>> import numpy
>>> mylist = [True, True, False]
>>> ~numpy.array(mylist)
array([False, False, True], dtype=bool)
>>> list(~numpy.array(mylist))
[False, False, True]