bin() 返回一个整数 int 或者长整数 long int 的二进制表示. 代码示例: print(bin(10)) 运行结果: F:\dev\python\python.exe F:/pyCharm/practice/config_dir/zip_demo.py0b1010 Process finished with exit code 0…
1.命令介绍 最近学习并使用了一个python的内置函数dir,首先help一下: 复制代码代码如下: >>> help(dir)Help on built-in function dir in module __builtin__: dir() dir([object]) -> list of strings Return an alphabetized list of names comprising (some of) the attributes of the…
使用Python内置函数:bin().oct().int().hex()可实现进制转换. 先看Python官方文档中对这几个内置函数的描述: bin(x)Convert an integer number to a binary string. The result is a valid Python expression. If x is not a Python int object, it has to define an __index__() method that returns a…