PythonPython

python数据分析基础(31-34)

2020-04-16  本文已影响0人  Zhigang_Han
31、一键帮助(接上面的Student对象)
help(han)
out:
Help on Student in module __main__ object:
class Student(builtins.object)
 |  Student(id, name)
 |  
 |  Methods defined here:
 |  
 |  __init__(self, id, name)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |  
 |  __repr__(self)
 |      Return repr(self).
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
32、返回对象的内存地址
id(han)
out:
139833399049184
33、获取用户输入
input()
han
out:
"han"
34、转为整型

int(x,base =10),x可能为字符串或数值,base为进制数。如果参数是字符串,那么它可能包含符号和小数点。如果超出了普通整数的表示范围,一个长整数被返回。

int("12",16)
out:
18
上一篇下一篇

猜你喜欢

热点阅读