This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ElGordo
Recipients ElGordo
Date 2007-12-13.18:06:36
SpamBayes Score 0.018870711
Marked as misclassified No
Message-id <1197569197.0.0.955231241156.issue1614@psf.upfronthosting.co.za>
In-reply-to
Content
Summary: "title" method of string objects does not 
   handle contractions and possessives correctly.
See the following short program and its results for examples.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
"""
Test of string method 'capitalize'
"""

stringList=["we're",
            "you're",
            "they're",
            "i've",
            "we've",
            "you've",
            "they've",
            "can't",
            "won't",
            "doesn't",
            "haven't",
            "daren't",
            "shouldn't",
            "weren't",
            "wasn't",
            "i'm"
            ]

for item in stringList:
    n=len(item)
    spaces=' '*(12-n)
    itemTitled = item.title()
    isATitle = itemTitled.istitle()
    print "%s -> %s%s is title=%s" %(item, spaces, itemTitled, isATitle)

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Results in:
we're ->        We'Re is title=True
you're ->       You'Re is title=True
they're ->      They'Re is title=True
i've ->         I'Ve is title=True
we've ->        We'Ve is title=True
you've ->       You'Ve is title=True
they've ->      They'Ve is title=True
can't ->        Can'T is title=True
won't ->        Won'T is title=True
doesn't ->      Doesn'T is title=True
haven't ->      Haven'T is title=True
daren't ->      Daren'T is title=True
shouldn't ->    Shouldn'T is title=True
weren't ->      Weren'T is title=True
wasn't ->       Wasn'T is title=True
i'm ->          I'M is title=True
History
Date User Action Args
2007-12-13 18:06:37ElGordosetspambayes_score: 0.0188707 -> 0.018870711
recipients: + ElGordo
2007-12-13 18:06:37ElGordosetspambayes_score: 0.0188707 -> 0.0188707
messageid: <1197569197.0.0.955231241156.issue1614@psf.upfronthosting.co.za>
2007-12-13 18:06:36ElGordolinkissue1614 messages
2007-12-13 18:06:36ElGordocreate