开发者

Python First Letter of a word Upper CASE [duplicate]

This question already has answers here: 开发者_运维问答 How can I capitalize the first letter of each word in a string? (23 answers) Closed 9 years ago.

I'm looking for some very clever and fast way of transforming every first character of a word in a string with the upper case.

ac milan > Ac Milan
paris saint germain > Paris Saint Germain


Use the title method of str:

'ac milan'.title()


Is this what you're looking for?

>>> "how now brown cow".title()
'How Now Brown Cow'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜