Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
全部。
我想在二进制中将 1 更改为 0 并将 0 更改为 1。
例如,
如果二进制是 00000110。我想将其更改为 11111001。
如何在python3中做到这一点?
此致。
您可以使用 ~ 运算符。如果 A = 00100,~A = 11011。如果 A 是十进制的字符串版本,请先将其转换为 int。