Python3 capitalize()方法

Python 3 教程 · 2019-02-05 19:11:45

描述

Python capitalize()将字符串的第一个字母变成大写,其他字母变小写。

语法

capitalize()方法语法:

str.capitalize()

参数

  • 无。

返回值

该方法返回一个首字母大写的字符串。

实例

以下实例展示了capitalize()方法的实例:

#!/usr/bin/python3

str = "this is string example from codercto....wow!!!"

print ("str.capitalize() : ", str.capitalize())

以上实例输出结果如下:

str.capitalize() :  This is string example from codercto....wow!!!

点击查看所有 Python 3 教程 文章: https://www.codercto.com/courses/l/10.html

查看所有标签

Pro Django

Pro Django

Marty Alchin / Apress / 2008-11-24 / USD 49.99

Django is the leading Python web application development framework. Learn how to leverage the Django web framework to its full potential in this advanced tutorial and reference. Endorsed by Django, Pr......一起来看看 《Pro Django》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具