开发者

Using python help to get help on MatchObject

开发者 https://www.devze.com 2023-02-14 09:30 出处:网络
I am trying to use the help() function in the Python interactive shell to get help on MatchObject. I have already imported re, and whether I try help(MatchObject), help(re.MatchObject), help(matchobje

I am trying to use the help() function in the Python interactive shell to get help on MatchObject. I have already imported re, and whether I try help(MatchObject), help(re.MatchObject), help(matchobject), or any other variation on these above choices I get a NameError.

I realize that I can look up help about MatchObject and its methods on the Internet, however I just wanted to get in the habit of using help() as my first 开发者_Python百科stop for finding information about something in Python (unless there are convincing arguments that this is a bad habit to get into), and there must still be some gaps in my understanding of either help() and/or the Python object hierarchy if I cannot get this to work.

Thank-you


I just tried

help(re.match) #help on method

or

 help(re.match(r"(\w+) (\w+)", "Isaac Newton, physicist")) #help on result

And official docs do look confusing. It does not seem that MatchObject class explicitly exists in Python.

0

精彩评论

暂无评论...
验证码 换一张
取 消