Python help () function and string.title function

Why not

import string;help(string.title) 

seems to work but

help(string.strip)

works great?

I get an error

Traceback (last last call):
File "", line 1, in AttributeError: object 'module' does not have attribute 'title'

+3
source share
2 answers

title- a method for type objects str, not a function in a module string. This means that you can do "foo".title()or str.title("foo"), but not string.title("foo").

+2
source

help(str.title)seems to be working fine.

+1
source

Source: https://habr.com/ru/post/1736594/


All Articles