Leo Kislov wrote:
>> Is there an easy way to get what I want?
>
> def title_words(s):
> words = re.split('(\s+)', s)
> return ''.join(word[0:1].upper()+word[1:] for word in words)
nit: to work well also for Unicode strings using arbitrary alphabets,
you should use title() instead of upp
Antoon Pardon wrote:
> I have a text in ascii. I use the ' for an apostroph. The problem is
> this gives problems with the title method. I don't want letters
> after a ' to be uppercased. Here are some examples:
>
>argument result expected
>
> 't smidje 'T Smidje
Antoon Pardon wrote:
> I have a text in ascii. I use the ' for an apostroph. The problem is
> this gives problems with the title method. I don't want letters
> after a ' to be uppercased. Here are some examples:
>
>argument result expected
>
> 't smidje 'T Smidje '
I have a text in ascii. I use the ' for an apostroph. The problem is
this gives problems with the title method. I don't want letters
after a ' to be uppercased. Here are some examples:
argument result expected
't smidje 'T Smidje 't Smidje
na'ama Na'Ama