- 博客(6)
- 收藏
- 关注
原创 Python title()方法
描述:Python title() 方法返回"标题化"的字符串,就是说所有单词都是以大写开始,其余字母均为小写。语法:str.title();参数:NA.返回值:返回"标题化"的字符串,就是说所有单词都是以大写开始。实例:>>> sen="My motherland is the people's Republic of China">>> sen.title()"My Motherland Is The People'S Republic Of C
2020-10-31 09:18:49
696
1
原创 Python lower()方法
描述:Python lower() 方法转换字符串中所有大写字符为小写。语法:str.lower()参数:NA.返回值:返回将字符串中所有大写字符转换为小写后生成的字符串。实例:>>> sen="My motherland is the people's Republic of China">>> sen.lower()"my motherland is the people's republic of china"...
2020-10-31 09:11:23
476
原创 Python upper()方法
描述:Python upper() 方法将字符串中的小写字母转为大写字母。语法:str.upper()参数:NA。返回值:返回小写字母转为大写字母的字符串。实例:>>> sen="My motherland is the people's Republic of China">>> sen.upper()"MY MOTHERLAND IS THE PEOPLE'S REPUBLIC OF CHINA"...
2020-10-31 09:05:29
1082
原创 Python 列表
Python 列表描述:列表由一系列按照指定顺序排列的元素组成。列表中的元素可以是不同类型。列表的表示用方括号"[ ]“将元素括起来,元素之间用 逗号”,"分隔。列表是序列类型的一 种,序列所有的特性和操作对于列表都是成立的,除此之外,列表还有自己的特殊操作。创建:直接使用列表的字面量。>>> a=[2,3,4,5,6,7,8,9,10] #创建一个列表>>> print(a)[2, 3, 4, 5, 6, 7, 8, 9, 10]>>&g
2020-10-29 14:32:31
163
原创 Python find()方法
>>> #find()的用法>>>> s='This is a test.'>>> print(s.find('is')) 2>>> print(s.find('a'))8>>> print(s.find('test'))10>>> print(s.find('ok'))-1>>> #指定查找开始位置>>> print(s.find('i
2020-10-28 21:10:13
599
原创 Python 原始字符串
>>> #原始字符串>>> print('hello\nworld')helloworld>>> print(r'hello\nworld')hello\nworld
2020-10-28 20:53:14
144
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人