capitalize() 是字符串的一个方法,用于把字符串的第一个字母转换成大写

In [1]: str = 'hello world'

In [2]: str.capitalize()
Out[2]: 'Hello world'

capitalize()的更多相关文章

  1. Python capitalize()方法

    Python capitalize()方法 capitalize()方法返回字符串的一个副本,只有它的第一个字母大写.对于8位的字符串,这个方法与语言环境相关. 语法 以下是capitalize()方 ...

  2. capitalize()在Python中含义

    Python为string对象提供了转换大小写的方法:upper() 和 lower(). 还不止这些,Python还为我们提供了首字母大写,其余小写的capitalize()方法, 以及所有单词首字 ...

  3. Python中capitalize()与title()的区别

    capitalize()与title()都可以实现字符串首字母大写.主要区别在于:capitalize(): 字符串第一个字母大写title(): 字符串内的所有单词的首字母大写 例如: >&g ...

  4. Python字符串capitalize center 方法

    一.capitalize 首字母大写 name = "wohaoshuai" print(name.capitalize()) #首字母大写 Wohaoshuai 二.center ...

  5. String的方法capitalize

    官方解释:Return a copy of the string with its first character capitalized and the rest lowercased.(返回字符串 ...

  6. str.replace()和re.sub()/calendar.month_abbr/re.subn()/upper和lower和capitalize/贪婪匹配和费贪婪匹配/re.S和re.DOTALL 笔记

    str.replace()可以进行简单的替换 >>> a = 'one.txt, index.py, index.php, index.html, index.js' >> ...

  7. python中的upper、lower、capitalize、title

    upper()字符串中字母由小写变为大写 lower()字符串中字母由大写变为小写 capitalize()字符串中字母首字母大写其余小写 title()字符串中字母每个单词的首字母大写其余小写 举个 ...

  8. map reduce 用法 str处理lower() capitalize()

    -- s=' l={':9}[s[0]] print(l) 取出dic里面key的元素 def normalize(name): tempn=name.lower().capitalize() ret ...

  9. python之函数用法capitalize()

    # -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法capitalize() #capitalize() #说明:将字符串的第一个字母变成 ...

  10. Python3基础 str capitalize 返回新字符串,第一个字母大写

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...

随机推荐

  1. LeetCode: Restore IP Addresses 解题报告

    Restore IP Addresses My Submissions Question Solution Given a string containing only digits, restore ...

  2. 基于js仿汽车之家2015新版焦点图代码

    今天给大家分享一款仿汽车之家2015新版焦点图代码.这是一款基于jQuery实现的适合电子商务网站或者企业产品展示功能特效.效果图如下: 在线预览   源码下载 实现的代码. html代码: < ...

  3. winform文本框不能粘贴、复制和屏蔽右键

    有3个常用方法 1.MouseMove事件中,使选不中 private void textBox3_MouseMove(object sender, MouseEventArgs e) { if (t ...

  4. 【C#】List列表的深复制,引用类型深复制

    需求:深复制该列表. Student实体类: public class Student { public string Name { get; set; } public int Age { get; ...

  5. Bit operator: Left shift and Right shift (Signed or unsigned? )

    No matter left shift or right shift, the result's sign should always be the same as its left operand ...

  6. Web API(二):Web API概述

    一.什么是API API(Application Programming Interface)即应用程序编程接口,是一些预先定义的函数,目的是提供应用程序与开发人员基于某软件或硬件得以访问一组例程的能 ...

  7. linux profile\bashrc\bash_profile之间的区别和联系

    /etc/profile 每个用户,首次登录时被执行: /etc/bashrc 每个运行bash shell的用户都执行此文件,当bsh被打开时,该文件被读取: ~/.bash_profile 专用于 ...

  8. QT 交叉编译工具选择

    使用QT交叉编译,生成的都是x86的可执行文件.Zoro告诉我交叉工具配置错了. 参考链接: http://www.cnblogs.com/zengjfgit/p/4744507.html linux ...

  9. C++类的成员函数的形参列表后面的const

    看到(C++ Primer)类的成员函数这里,突然对成员函数形参列表后面的const感到迷惑. 因为书中开始说是修饰隐含形参this的,然后又说是声明该函数是只读的. 大为不解! 翻资料.找人讨论.. ...

  10. 关于Random中的随机数种子Seed

    Random初始化的时候,可以以一个INT32作为参数,称为seed,MSDN上的解释是:“伪随机数是以相同的概率从一组有限的数字中选取的......随机数的生成是从种子值开始......” 所有标准 ...