标签:color int blog http bool abs ble 字符串 images
#abs 求绝对值 print(abs(-1)) #all #判断函数内部的布尔值,如果都是Trun则返回true #空是True print(all([1,2,‘a‘,None])) print(all([])) #bool值为假的情况:None,空,0,False #any #如果函数内部的布尔值任意有一个为True则返回True #空是False print(any([])) print(any([‘ ‘,None,False])) #True print(any([‘‘,None,False])) #False print(any([‘‘,None,False,1])) #True #bin,oct,hex #分别代表返回二进制 返回八进制 返回十六进制 print(bin(10)) #0b开头 print(oct(10)) #0o开头 print(hex(10)) #0x开头 #bytes #将字符串转换成bytes类型 #unicode----encode----->bytes print(‘hello‘.encode(‘utf-8‘)) print(bytes(‘hello‘,encoding=‘utf-8‘)) #callable #查看对象是否是可调用对象 print(callable(bytes)) print(callable(abs)) #chr,ord #chr打印ascii码中编号对应的字符 #ord打印字符在ascii中的编号 print(chr(65)) print(chr(90)) # print(ord(‘#‘))
标签:color int blog http bool abs ble 字符串 images
原文地址:http://www.cnblogs.com/yxwang/p/7295456.html