Capitalizing hyphenated name
<p>I have a script looking like this:</p>

<pre><code>firstn = input('Please enter your first name: ') 
lastn = input('Please enter Your last name: ') 
print('Good day, ' + str.capitalize(firstn) + ' ' + str.capitalize(lastn)+ '!')
</code></pre>

<p>It will work nicely with simple names like jack black or morgan meeman but when I input hyphenated name like <code>jordan-bellfort image</code> then I'd expect <code>"Jordan-Bellfort Image"</code> but I receive <code>"Jordan-bellfort Image"</code>.</p>

<p>How can I get python to capitalize the character right after hyphen?</p>

<p>I'd suggest just using <a href="https://docs.python.org/2/library/stdtypes.html#str.title" rel="nofollow">str.title</a>, here's a working example comparing your version and the one using str.title method:</p>

<pre><code>import string

tests = [
    ["jack", "black"],
    ["morgan", "meeman"],
    ["jordan-bellfort", "image"]
]

for t in tests:
    firstn, lastn = t
    print('Good day, ' + str.capitalize(firstn) +
          ' ' + str.capitalize(lastn) + '!')
    print('Good day, ' + firstn.title() + ' ' + lastn.title() + '!')
    print('-'*80)
</code></pre>

<p>Resulting into this:</p>

<pre><code>Good day, Jack Black!
Good day, Jack Black!
--------------------------------------------------------------------------------
Good day, Morgan Meeman!
Good day, Morgan Meeman!
--------------------------------------------------------------------------------
Good day, Jordan-bellfort Image!
Good day, Jordan-Bellfort Image!
--------------------------------------------------------------------------------
</code></pre>

python capitalize