Skip to content

Instantly share code, notes, and snippets.

@AndrewHazelden
Created December 9, 2015 11:35
Show Gist options
  • Save AndrewHazelden/dd8ee1952db161314d84 to your computer and use it in GitHub Desktop.
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
# 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