What does squiggle (tilde) do, i.e. The `~` operator in Python?

Possible duplicate:
Tilde operator in Python

What does the squiggle operator do, i.e. ~in python?

(This is probably Python 101 for most, but I met ~in the code and had no idea what it was, and it took me a lot of research to figure it out, so I hope this Q&A can help someone along the way.)

+5
source share
1 answer

This is a unary bitwise inverting operator .

~ () . x -(x+1). .

+9

All Articles