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 trialyahyaalshwaily2
Python Development Techdegree Graduate 20,049 PointsWhat does .title() do in category.title() ?
Hi,
What does .title() do in category.title() exactly? I removed it and it did not affect the output at all.
<div class="items">
{% for category, choices in options.items() %}
{% if category != 'colors' %}
<div class="grid-100 row">
<div class="grid-20">
<p class='category-title'>{{ category }}</p>
</div>
Thanks in advance!
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsThe title()
method is part of the str
object:
>>> "this is a string".title()
βThis Is A Stringβ
You might get similar results using
{{ category|title }}
Post back if you need more help. Good luck!!!
yahyaalshwaily2
Python Development Techdegree Graduate 20,049 Pointsyahyaalshwaily2
Python Development Techdegree Graduate 20,049 PointsHi Chris, I forgot what the .title() method does from "Python Basics" course. Thanks for the reminder. Also thank you for this tip {{category|title}}