In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces "how to use the dir () function and help () function in python". In daily operation, I believe that many people have doubts about how to use the dir () function and help () function in python. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about how to use the dir () function and help () function in python. Next, please follow the editor to study!
1. Dir () function
In python, the dir () function can return a list of variables, methods, and defined types in the current range without arguments, while the dir () function can return a list of properties and methods of parameters when it takes parameters.
Syntax:
Dir ([object]) # object refers to objects, variables, types.
Example:
> dir () # get the attribute list of the current module
['_ builtins__','_ _ doc__','_ _ name__','_ _ package__', 'arr',' myslice']
> dir ([]) # how to view the list
['_ _ add__','_ _ class__','_ _ contains__','_ _ delattr__','_ _ delitem__','_ _ delslice__','_ _ doc__','_ _ eq__','_ _ format__','_ _ ge__','_ getattribute__','_ getitem__','_ _ getslice__','_ _ gt__' '_ _ hash__',' _ _ iadd__','_ _ imul__','_ _ init__','_ _ iter__','_ _ le__','_ _ len__','_ _ lt__','_ _ mul__','_ _ ne__','_ new__','_ reduce__','_ reduce_ex__','_ _ repr__' '_ _ reversed__',' _ _ rmul__','_ _ setattr__','_ _ setitem__','_ _ setslice__','_ _ sizeof__','_ _ str__','_ _ subclasshook__', 'append',' count', 'extend',' index', 'insert',' pop', 'remove',' reverse', 'sort']
2. Help () function
In python, the help () function is mainly used to view a detailed description of the purpose of a function or module.
Syntax:
Help ([object]) # object refers to an object
Example:
> help ('sys') # View help for the sys module
…… Show help information...
> help ('str') # View help on str data types
…… Show help information...
> a = [1, 2, 2, 3]
> help (a) # View list list help information
…… Show help information...
>
…… Show help information...
At this point, the study on "how to use the dir () function and help () function in python" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.