Created
December 9, 2015 11:35
-
-
Save AndrewHazelden/dd8ee1952db161314d84 to your computer and use it in GitHub Desktop.
A Python script for converting a text string into "Title Case" style formatting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Capitalize the first letter of each word a string | |
textString = 'hello world!' | |
print textString.title() | |
# Output: Hello World | |
# Now try the title case conversion on elements in an array | |
cubicViews = [] | |
cubicViews.append('back') | |
cubicViews.append('bottom') | |
cubicViews.append('front') | |
cubicViews.append('left') | |
cubicViews.append('right') | |
cubicViews.append('top') | |
for view in cubicViews: | |
print view.title() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment