个人主页:天寒雨落的博客_CSDN博客-C,CSDN竞赛,python领域博主
特别标注:仅为自己的学习记录笔记,方便复习和加深记忆,仅供借鉴参考!
目录
char缩写,将整数x通过对照其ascll码转化为对应的一个字符
代码
- x=65
- print(chr(x))
执行结果

ordinal缩写,意思为序数词,将字符x转化为它对应的整数
代码
- x='a'
- print(ord(x))
执行结果


代码
- list1=eval(input("请输入整数列表:"))
- list1=[str(i) for i in list1]
- print(list1)
执行结果

代码
- list1=eval(input("请输入整数列表:"))
- list1=list(map(str,list1))
- print(list1)
执行结果


返回0b加十进制数转为二进制的数
代码
- x=15
- print(bin(x))
执行结果

- x=15
- print(format(x,'b'))
运行结果

返回0o加十进制数转为八进制的数
代码
- x=15
- print(oct(x))
执行结果

代码
- x=15
- print('%o' % x)
执行结果

代码
- x=15
- print(format(x,'o'))
执行结果

返回0x加十进制数转为十六进制的值
代码
- x=15
- print(hex(x))
执行结果

代码
- x=15
- print('%x' % x)
执行结果

代码
- x=15
- print(format(x,'x'))
执行结果

代码
print(int("01010",2))
执行结果

代码
print(int("101",8))
执行结果

代码
print(int("df",16))
执行结果

各位学习python的朋友可以联系我,互相讨论,一起进步!!!
👍+✏️+⭐️是对博主最大的鼓励与支持!!!