标签:script driver eof attribute bsp getattr more subclass object
dir()用来查询一个类或者对象所有属性,比如:
>>> dir(list) [‘__add__‘, ‘__class__‘, ‘__contains__‘, ‘__delattr__‘, ‘__delitem__‘, ‘__dir__‘, ‘__doc__‘, ‘__eq__‘, ‘__format__‘, ‘__ge__‘, ‘__getattribute__‘, ‘__getitem__‘, ‘__gt__‘, ‘__hash__‘, ‘__iadd__‘, ‘__imul__‘, ‘__init__‘, ‘__iter__‘, ‘__le__‘, ‘__len__‘, ‘__lt__‘, ‘__mul__‘, ‘__ne__‘, ‘__new__‘, ‘__reduce__‘, ‘__reduce_ex__‘, ‘__repr__‘, ‘__reversed__‘, ‘__rmul__‘, ‘__setattr__‘, ‘__setitem__‘, ‘__sizeof__‘, ‘__str__‘, ‘__subclasshook__‘, ‘append‘, ‘clear‘, ‘copy‘, ‘count‘, ‘extend‘, ‘index‘, ‘insert‘, ‘pop‘, ‘remove‘, ‘reverse‘, ‘sort‘] >>>
help()函数帮助我们了解模块、类型、对象、方法、属性的详细信息
1.帮助查看类型详细信息,包含类的创建方式、属性、方法
>>> help(list) Help on class list in module builtins: class list(object) | list() -> new empty list | list(iterable) -> new list initialized from iterable‘s items | | Methods defined here: | | __add__(self, value, /) | Return self+value. | | __contains__(self, key, /) | Return key in self. | | __delitem__(self, key, /) | Delete self[key]. | | __eq__(self, value, /) | Return self==value. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getitem__(...) | x.__getitem__(y) <==> x[y] | | __gt__(self, value, /) | Return self>value. | | __iadd__(self, value, /) | Implement self+=value. | | __imul__(self, value, /) | Implement self*=value. | | __init__(self, /, *args, **kwargs) -- More --
2.帮助查看方法的详细使用信息(使用时要注意输入完整路径,使用模块帮助时,需要先导入模块)
>>> from selenium.webdriver.common.by import By >>> help(By) Help on class By in module selenium.webdriver.common.by: class By(builtins.object) | Set of supported locator strategies. | | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | CLASS_NAME = ‘class name‘ | | CSS_SELECTOR = ‘css selector‘ | | ID = ‘id‘ | | LINK_TEXT = ‘link text‘ | | NAME = ‘name‘ | | PARTIAL_LINK_TEXT = ‘partial link text‘ | | TAG_NAME = ‘tag name‘ | | XPATH = ‘xpath‘ >>>
标签:script driver eof attribute bsp getattr more subclass object
原文地址:https://www.cnblogs.com/fireporsche/p/9441848.html