Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Bhoutik Mehta
2,945 PointsHelp() Function
I had a question regarding the help() function. When I typed help(str), the shell returned a bunch of attributes like the following: | add(self, value, /) | Return self+value.
However, when I typed in help(str.add), I got the following error: AttributeError: type object 'str' has no attribute 'add'
2 Answers
William Li
Courses Plus Student 26,868 Pointsthat's because str really does NOT have add attribute, but it has __add__. So if you type in
help(str.__add__)
It will show you sth related to __add__. Hope it helps.
Dustin James
11,364 PointsNotate the "dunder" lines (underscores). Check out this link
help(str.__add__)
Bhoutik Mehta
2,945 PointsBhoutik Mehta
2,945 PointsSweet. Thanks a lot buddy!