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

Python Python Basics (Retired) Say Hello to Python Help!

Sergei Miroshnikov
Sergei Miroshnikov
3,313 Points

print(str) no longer behaves as in example , it just prints <class 'str'>

Nothing more to add

3 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

str is a built-in for the string class. Did you assign a value to it before you tried to do print(str)? If not, yes, it prints what you posted, which is the representation of the class.

Sergei Miroshnikov
Sergei Miroshnikov
3,313 Points

Thanks that helped .

Ok , I re-tried that , I typed str(3) in the python shell , got '3' as result , and then when I typed help(str) I got help on class . Why did this work that way ? I mean, why I had to do this initialization ? I need to initialize every class each time before I use help ?

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Nope, you can just do help(str) right away and get help on it.

Sergei Miroshnikov
Sergei Miroshnikov
3,313 Points

I finally got it , I misplaced help(str) and print(str) , everything works as intended , my mistake , thank you .

mmm i think they is no answer yet since i have tried all your methods to get help to (str) but no clue.i dont have the answer now, i am still searching

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

help(str) will give you the help documentation for the str class.