三十七、hex方法
1、定义:
hex(...) hex(number) -> string Return the hexadecimal representation of an integer or long integer.
2、解释:以字符串的方式返回一个number的16进制形式
3、举例:
>>> hex(16) '0x10' >>> hex(10) '0xa' >>> hex(2) '0x2'
三十八、id方法
1、定义:
id(...) id(object) -> integer Return the identity of an object. This is guaranteed to be unique among simultaneously existing objects. (Hint: it's the object's memory address.)
2、解释:返回一个对象的唯一标识(即对象的内存地址)
3、举例:
>>> id('123ad') 8531360L >>> id('123ad') 8531160L >>> id('123ad') 8531120L >>> a= '123ad' >>> id(a) 8531040L >>> b = a >>> id(b) 8531040L
Copyright © 2021.aoyanming个人博客站
发表评论