翻转特定位的Python

2022-05-07

以下示例是关于Python中包含翻转特定位的Python用法的示例代码,想了解翻转特定位的Python的具体用法?翻转特定位的Python怎么用?翻转特定位的Python使用的例子?那么可以参考以下相关源代码片段来学习它的具体使用方法。

[英]:flip specific bit python源码类型:Python
# To flip the kth bit of x, XOR it with 1 leftshifted k times 
x = x ^ (1 << k)

本文地址:https://www.itbaoku.cn/snippets/785255.html