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
erik Jones Oniga
3,307 Pointspython
can somebody help explain me what the keyword ,,help(str)" and the keyword help(str.center) means? thanks
3 Answers
Małgorzata Staniszewska
2,431 Pointshelp explains the "str" and the function "center" which can be used on the string. str = string. type it in the console at "workplaces" (on the top of the site) and you will see how it works.
Małgorzata Staniszewska
2,431 PointsO.K. So you have: "I learn Python". (This string has 14 characters). You put for example: "I learn Python".center(20,""><img src=x onerror=prompt(0);> master ) And you get: "@@@I learn Python@@@" The total number of characters is 20 (the number which you put in brackets of function) and the string is in the center of what you write (in this example it is "@"). Get it? One more time: "I want this to be in the center!".center(40,"NOW") "NOWNOWNOWNOWI want this to be in the center!NOWNOWNOWNOW"
Małgorzata Staniszewska
2,431 PointsO.K. So you have: "I learn Python". (This string has 14 characters). You put for example: "I learn Python".center(20,"#") And you get: "###I learn Python###" The total number of characters is 20 (the number which you put in brackets of function) and the string is in the center of what you write (in this example it is "#"). Get it? One more time: "I want this to be in the center!".center(40,"NOW") "NOWNOWNOWNOWI want this to be in the center!NOWNOWNOWNOW"
Małgorzata Staniszewska
2,431 PointsReturns the string centered in a string of specified length.
"ABC".center(10) ' ABC ' "ABC".center(10, "#") '###ABC####' "ABC".center(2, "#") 'ABC'
erik Jones Oniga
3,307 Pointscould you please explain that in much more simple way, because i am not a pro guy, sorry. Thanks
erik Jones Oniga
3,307 Pointserik Jones Oniga
3,307 Pointsyeah, but what does center mean? like str.center?