Python字符串(str)及其内置方法详解

目录

字符串是一种用来表示文本的数据类型,它是由符号或者数值组成的一个连续序列。

1、了解定义字符串:

2、数据类型转换:

3、转义符号:

4、字符串的索引

⚠️注意

5、字符串的内置方法

6.格式化输出


字符串是一种用来表示文本的数据类型,它是由符号或者数值组成的一个连续序列。

1、了解定义字符串:

在 Python 中,字符串是一种常见的数据类型,用于表示文本信息。一个字符串可以包含多个字符,在 Python 中使用单引号、双引号或三引号表示,例如:

s1 = 'Hello, World!'    # 使用单引号表示字符串
s2 = "Python is great!"    # 使用双引号表示字符串
s3 = '''This is a 
multi-line 
string.'''    # 使用三引号表示多行字符串

在 Python 中,字符串是不可变(immutable)的,即不能修改字符串中的某个字符。但可以使用下标访问字符串中的单个字符,例如:

s = 'Python'
print(s[0])    # 输出 P
print(s[-1])   # 输出 n

可以使用加号(+)运算符将两个字符串合并成一个新的字符串,例如:

s1 = 'Hello'
s2 = 'World'
s3 = s1 + ', ' + s2 + '!'
print(s3)    # 输出 Hello, World!

2、数据类型转换:

使用str()可以将任意数据类型转换成字符串类型

在 Python 中,str 是一种基本数据类型,表示字符串。有时候需要将其他类型的数据转换为字符串,或者将字符串转换为其他类型的数据。Python 提供了一些内置函数,可以实现这种类型转换。

1.str其他类型转换为 str

要将其他类型的数据转换为字符串,可以使用内置函数 str(),它可以接受任何类型的参数,并返回对应的字符串。

a = 123
b = 3.14
c = True
s1 = str(a)
s2 = str(b)
s3 = str(c)
print(s1, s2, s3)    # 输出 "123 3.14 True"

对于复杂的数据结构,str() 函数会自动调用对象的 __str__() 方法,返回一个可读性较好的字符串表示。

2.str转换为 int 或 float

要将字符串转换为整数或浮点数,可以使用内置函数 int() 或 float()。

s1 = '123'
s2 = '3.14'
a = int(s1)
b = float(s2)
print(a, b)    # 输出 123 3.14

需要注意的是,如果字符串不能被解析为有效的数字,则会抛出 ValueError 异常。

3.其他类型转换

除了上述常见类型外,还有一些其他类型的数据可以进行转换,例如 bool 类型、list 类型、tuple 类型等。可以通过直接或间接地调用相应的构造函数实现转换。

a = 0
b = ''
c = []
d = {}
e = ()
f = None
s1 = bool(a)
s2 = str(a)
s3 = list(e)
s4 = tuple(c)
s5 = dict(d)
i1 = int(s2)
print(s1, s2, s3, s4, s5, i1)    # 输出 False "0" [] () {} 0

需要注意的是,一些类型之间的转换可能存在损失精度或改变数据结构的风险,需要根据实际需求谨慎选择。

3、转义符号:

转义字符是指使用反斜杠“”对一些特殊字符进行转义,即改变原有字符含义的特殊字符,在引号里面使用。

如果不让转义符号生效要用 r 或 R 来定义原始字符串

original = r"我是原始字符串\n"
print("original : ", original)	#我是原始字符串\n

4、字符串的索引

字符串是一个由元素组成的序列,每个元素所处的位置是固定的, 并且对应着一个位置编号,编号从0开始,依次递增1,这个位置编号被称为索引或者下标。

⚠️注意

注意

1、Python 没有单独的字符类型,一个字符串的长度就是为 1

2、单引号与双引号可以嵌套使用,单引号表示的字符串中可以嵌套双引号的字符串, 但是单引号不允许嵌套单引号;

3、字符串可以用+运算符拼接在一起,用*运算符重复

4、Python中的字符串不能改变,可变的对象修改之后,前后地址不变,不可变对象修改地址之后,前后地址会变

正向索引:索引从 0 开始从左往右依次递增

反向索引:索引从- 1 开始从右到左依次递减

5、字符串的内置方法

Python 字符串的内置方法非常丰富,包括字符串查找、替换、分割、大小写转换、判断等等。

a. 字符串查找

str.find(sub[, start[, end]]):从左到右查找子字符串 sub 在 str 中的位置,返回第一个匹配项的索引位置。如果没有找到,则返回 -1。start 和 end 参数表示查找的范围,默认为整个字符串。
# 查找子字符串,返回索引位置
s = 'hello, world'
print(s.find('o'))  # 4
print(s.find('o', 5))  # 8,从第 5 个位置开始查找
print(s.find('o', 5, 7))  # -1,查找范围为 [5, 7)

str.rfind(sub[, start[, end]]):从右到左查找子字符串 sub 在 str 中的位置,返回最后一个匹配项的索引位置。如果没有找到,则返回 -1。start 和 end 参数表示查找的范围,默认为整个字符串。
# 从右到左查找子字符串,返回索引位置
s = 'hello, world'
print(s.rfind('o'))  # 8
print(s.rfind('o', 0, -2))  # 4,查找范围为 [0, -2)

str.index(sub[, start[, end]]):与 find() 方法类似,从左到右查找子字符串 sub 在 str 中的位置,返回第一个匹配项的索引位置。如果没有找到,则抛出 ValueError 异常。
# 查找子字符串,返回索引位置,没有找到则抛出异常
s = 'hello, world'
print(s.index('o'))  # 4
print(s.index('o', 5))  # 8,从第 5 个位置开始查找
print(s.index('o', 5, 7))  # ValueError: substring not found

str.rindex(sub[, start[, end]]):与 rfind() 方法类似,从右到左查找子字符串 sub 在 str 中的位置,返回最后一个匹配项的索引位置。如果没有找到,则抛出 ValueError 异常。
# 从右到左查找子字符串,返回索引位置,没有找到则抛出异常
s = 'hello, world'
print(s.rindex('o'))  # 8
print(s.rindex('o', 0, -2))  # 4,查找范围为 [0, -2)
print(s.rindex('o', 5, 7))  # ValueError: substring not found

b. 字符串替换

str.replace(old, new[, count]):将 str 中的所有 old 子串替换为 new,返回新的字符串。如果指定了 count,则只替换前 count 个出现的子串。

# 替换子字符串
s = 'hello, world'
print(s.replace('o', 'O'))  # hellO, wOrld
print(s.replace('o', 'O', 1))  # hellO, world,只替换第一个出现的子串

# 用新的字符替换字符串中旧的字符
str7 = 'my name is tony, my age is 18!'  # 将tony的年龄由18岁改成73岁
str7 = str7.replace('18', '73') 		 # 语法:replace('旧内容', '新内容')	#my name is tony, my age is 73!

# 可以指定修改的个数
str7 = 'my name is tony, my age is 18!'
str7 = str7.replace('my', 'MY',1) 		 # 只把一个my改为MY	#'MY name is tony, my age is 18!'
str.maketrans(x[, y[, z]]):创建字符映射表,用于 translate() 方法的参数。x 是需要转换的字符,y 是转换后的字符,z 是需要删除的字符。

# 创建字符映射表
trans_table = str.maketrans('abc', '123')
print(trans_table)  # {97: 49, 98: 50, 99: 51}
str.translate(table):根据字符映射表 table 对字符串进行转换。

# 根据字符映射表转换字符串
s = 'abc'
trans_table = str.maketrans('abc', '123')
print(s.translate(trans_table))  # 123
expandtabs() 方法可以将字符串中的制表符 `\t` 转换为空格,并根据指定的 tabsize 将连续的多个空格替换为一个制表符或若干个空格。
str.expandtabs(tabsize = 8)
其中,tabsize 为可选参数,默认值为 8。

示例代码:
str1 = 'a\tb\tc'
result = str1.expandtabs()
print(result)  # 输出 'a       b       c'
str2 = 'a    b    c'
result = str2.expandtabs(4)
print(result)  # 输出 'a   b   c'

c. 字符串分割和连接

str.split(sep=None, maxsplit=-1):以 sep 为分隔符对 str 进行分割,返回一个列表。maxsplit 指定最多分割次数,默认为 -1,表示不限制。

# 分割字符串
s = 'hello, world'##可以使用解压赋值给切分出来赋一个变量,但是切多少块就给多少变量名
print(s.split())  # ['hello,', 'world'],默认以空格进行分割
print(s.split(','))  # ['hello', ' world'],以逗号进行分割
print(s.split(',', 1))  # ['hello', ' world'],最多分割一次
str.rsplit(sep=None, maxsplit=-1):与 split() 方法类似,但从右向左分割。

# 从右向左分割字符串
s = 'hello, world'
print(s.rsplit())  # ['hello,', 'world']
print(s.rsplit(',', 1))  # ['hello', ' world'] 可以指定切割次数,只有用切割次数才能看出来
str.join(iterable):将可迭代对象 iterable 中的字符串连接起来,返回一个新的字符串。

# 连接字符串
lst = ['hello', 'world']
print('|'.join(lst))  # hello|world

# 从可迭代对象中取出多个字符串,然后按照指定的分隔符进行拼接,拼接的结果为字符串
'%'.join('hello') 				# 从字符串'hello'中取出多个字符串,然后按照%作为分隔符号进行拼接
打印结果:'h%e%l%l%o'
'|'.join(['tony','18','read'])  # 从列表中取出多个字符串,然后按照|作为分隔符号进行拼接
打印结果:'tony|18|read'

d. 字符串大小写转换

str.capitalize():将首字母变为大写,返回一个新的字符串。
# 首字母大写
s = 'hello, world'
print(s.capitalize())  # Hello, world
str.title():将每个单词的首字母变为大写,返回一个新的字符串。

# 每个单词首字母大写
s = 'hello, world'
print(s.title())  # Hello, World
str.lower():将所有字符变为小写,返回一个新的字符串。

# 所有字符变为小写
s = 'Hello, World'
print(s.lower())  # hello, world
str.upper():将所有字符变为大写,返回一个新的字符串。

# 所有字符变为大写
s = 'Hello, World'
print(s.upper())  # HELLO, WORLD
str.swapcase():将所有大写字母变为小写,所有小写字母变为大写,返回一个新的字符串。

# 大小写互换
s = 'Hello, World'
print(s.swapcase())  # hELLO, wORLD

e. 字符串判断

str.startswith(prefix[, start[, end]]):判断 str 是否以指定的前缀 prefix 开始。start 和 end 参数表示查找范围,默认为整个字符串。
# 判断字符串是否以指定前缀开始
s = 'hello, world'
print(s.startswith('h'))  # True
print(s.startswith('o', 4))  # True,从第 4 个位置开始查找
print(s.startswith('w', 7))  # False,从第 7 个位置开始查找
str.endswith(suffix[, start[, end]]):判断 str 是否以指定的后缀 suffix 结束。start 和 end 参数表示查找范围,默认为整个字符串。
# 判断字符串是否以指定后缀结束
s = 'hello, world'
print(s.endswith('d'))  # True
print(s.endswith('l', 0, 3))  # True,查找范围为 [0, 3)
print(s.endswith('w', 0, 7))  # False,查找范围为 [0, 7)
str.isalpha():判断 str 是否只包含字母。
# 判断字符串是否只包含字母
s1 = 'hello'
s2 = 'hello!'
print(s1.isalpha())  # True
print(s2.isalpha())  # False,包含 '!'
str.isdigit():判断 str 是否只包含数字,是否为纯数字组成
# 判断字符串是否只包含数字
s1 = '123'
s2 = '123a'
print(s1.isdigit())  # True
print(s2.isdigit())  # False,包含 'a'
str.isalnum():判断 str 是否只包含字母和数字。
# 判断字符串是否只包含字母和数字
s1 = 'hello123'
s2 = 'hello, world'
print(s1.isalnum())  # True
print(s2.isalnum())  # False,包含 ','
str.islower():判断 str 是否全部为小写字母。
# 判断字符串是否全部为小写字母
s1 = 'hello'
s2 = 'Hello'
print(s1.islower())  # True
print(s2.islower())  # False,首字母为大写
str.isupper():判断 str 是否全部为大写字母。
# 判断字符串是否全部为大写字母
s1 = 'HELLO'
s2 = 'Hello'
print(s1.isupper())  # True
print(s2.isupper())  # False,包含小写字母
str.isspace():判断 str 是否只包含空白字符。
# 判断字符串是否只包含空白字符
s1 = ' \t\n'
s2 = ' hello '
print(s1.isspace())  # True
print(s2.isspace())  # False,包含字母
isnumeric() 方法用于判断字符串中的字符是否都属于数字字符。其中,除了数字 0 ~ 9 之外,还包括罗马数字、汉字数字、全角数字等
str.isnumeric()

示例代码:
str1 = '123456'
print(str1.isnumeric())  # 输出 True

str2 = '①②③④⑤'
print(str2.isnumeric())  # 输出 True

str3 = '四百五十六'
print(str3.isnumeric())  # 输出 True

str4 = '12ab34'
print(str4.isnumeric())  # 输出 False
isdecimal() 和 isnumeric() 非常相似,也是用来判断字符串中的字符是否都属于数字字符。不同之处在于,isdecimal() 方法只针对数字 0 ~ 9 进行判断,而不包括罗马数字、汉字数字、全角数字等
str.isdecimal()

示例代码:

str1 = '123456'
print(str1.isdecimal())  # 输出 True

str2 = '①②③④⑤'
print(str2.isdecimal())  # 输出 False

str3 = '四百五十六'
print(str3.isdecimal())  # 输出 False

str4 = '12ab34'
print(str4.isdecimal())  # 输出 False
isidentifier() 方法用于判断字符串是否是一个合法的标识符。标识符通常用来表示变量、函数、类等名称,它的命名规则和 Python 中变量命名的规则相同。具体而言,标识符只能由字母、下划线、数字组成,且不能以数字开头。
str.isidentifier()

示例代码:
str1 = 'hello'
print(str1.isidentifier())  # 输出 True

str2 = 'hello world'
print(str2.isidentifier())  # 输出 False

str3 = '_hello'
print(str3.isidentifier())  # 输出 True

str4 = '123hello'
print(str4.isidentifier())  # 输出 False

需要注意的是,Python 中有一些关键字是不能用作标识符的,例如 `if`、`while`、`for` 等。同时,Python 中的标识符是区分大小写的。

f. 其他

count() 方法是用来返回指定元素在列表、字符串等对象中出现的次数。它的语法格式如下:
object.count(element)
"""其中,object 是需要检查的对象,element 是需要计数的元素。"""

1.列表中元素的计数
list1 = ['apple', 'banana', 'cherry', 'banana']
count = list1.count('banana')
print(count)  # 输出 2

2.字符串中字符的计数
str1 = 'Hello, world!'
count = str1.count('o')
print(count)  # 输出 2

3.检查子字符串的计数
str2 = 'To be or not to be, that is the question.'
count = str2.count('be')
print(count)  # 输出 2

需要注意的是,count() 方法只能统计可哈希的对象类型(可作为字典的键),因此不能用于统计集合、字典等不可哈希的对象类型。同时,如果统计的元素不存在于对象中,count() 方法会返回 0。
strip() 移除字符串首尾指定的字符(默认移除空格)

lstrip() 只移除左边的指定字符

rstrip() 只移除右边的指定字符

# 去除字符串首尾指定字符
s = '   hello, world   '
print(s.strip())  # 'hello, world',去除首尾的空格
print(s.lstrip())  # 'hello, world   ',只去除左侧的空格
print(s.rstrip())  # '   hello, world',只去除右侧的空格

# 去除字符串首尾指定字符,括号内不指定字符,默认以空格作为切分符号,括号内指定分隔字符,则按照括号内指定的字符切割字符串(空格、\n、\t)
s = '***hello, world***'
print(s.strip('*'))  # 'hello, world',去除首尾的'*'
print(s.lstrip('*'))  # 'hello, world***',只去除左侧的'*'
print(s.rstrip('*'))  # '***hello, world',只去除右侧的'*'
center() 方法是用来将字符串居中显示,并用指定的字符填充空白部分。它的语法格式如下:
string.center(width[, fillchar])
"""其中,string 是需要居中的字符串,width 是设置的总宽度(包括原字符串),fillchar 是可选参数,用来指定填充空白部分的字符。如果不指定,就用空格来填充。"""

1.居中显示并用空格填充
str1 = 'Hello'
result = str1.center(10)
print(result)  # 输出 '  Hello   '

2.居中显示并用指定字符填充
str2 = 'World'
result = str2.center(10, '*')
print(result)  # 输出 '**World***'

"""
上面的示例中,第一个例子中的字符串 Hello 居中显示,总宽度是 10,因此需要在前后填充 2 个空格。在第二个例子中,字符串 World 居中显示,总宽度为 10,填充字符为 *,因此需要在前后各填充 2 个 *。

需要注意的是,如果指定的总宽度小于原字符串的长度,center() 方法并不会将字符串截断,而是直接返回原字符串。如果不指定填充字符,也不会把空白部分填充为其他字符,而是默认用空格填充。
"""
ljust()、rjust() 和 zfill() 方法都是用来对字符串进行填充的方法,它们的主要区别在于填充的方向和填充内容。
ljust():将字符串左对齐,并用指定字符填充右侧空白部分。
rjust():将字符串右对齐,并用指定字符填充左侧空白部分。
zfill():在字符串左侧用 0 填充,使其达到指定长度。

1.ljust()
string.ljust(width[, fillchar])
其中,string 是需要左对齐的字符串,width 是设置的总宽度(包括原字符串),fillchar 是可选参数,用来指定填充空白部分的字符。如果不指定,就用空格来填充。例如:
# 左对齐并用空格填充
str1 = 'Hello'
result = str1.ljust(10)
print(result)  # 输出 'Hello     '
# 左对齐并用指定字符填充
str2 = 'World'
result = str2.ljust(10, '*')
print(result)  # 输出 'World*****'

2.rjust()
string.rjust(width[, fillchar])
其中,string 是需要右对齐的字符串,width 是设置的总宽度(包括原字符串),fillchar 是可选参数,用来指定填充空白部分的字符。如果不指定,就用空格来填充。例如:
str1 = 'Hello'
result = str1.rjust(10, '*')
print(result)  # 输出 '*****Hello'

3.zfill()
string.zfill(width)
其中,string 是需要左侧填充 0 的字符串,width 是设置的总宽度(包括原字符串)。例如:
str1 = '123'
result = str1.zfill(5)
print(result)  # 输出 '00123'
需要注意的是,以上三种方法都是返回一个新的字符串,并不会改变原有字符串的值。如果指定的宽度小于原字符串长度,则不进行任何填充操作,直接返回原有字符串。

6.格式化输出

  • 什么是格式化输出: 把一段字符串里面的某些内容替换掉之后再输出,就是格式化输出。
  • 为什么要格式化输出: 我们经常会输出具有某种固定格式的内容,比如:'亲爱的xxx你好!你xxx月的话费是xxx,余额是xxx‘,我们需要做的就是将xxx替换为具体的内容。
  • Python 格式化输出的方式有三种:
  • 使用 % 运算符
  • 使用 format() 方法
  • 使用 f-string(Python 3.6+)
  • 1. 使用 % 运算符

    在字符串中,可以使用 % 运算符实现格式化输出。

  • %s 表示字符串占位符
  • %d 表示整数占位符
  • %f 表示浮点数占位符
  • %X 表示十六进制整数占位符
  • %x 表示十六进制整数占位符(小写)
  • %o 表示八进制整数占位符
  • %e 表示科学计数法占位符
  • 1.字符串格式化输出
    name = 'Alice'
    age = 18
    print('My name is %s, and I am %d years old.' % (name, age))
    
    2.浮点数格式化输出
    pi = 3.1415926
    print('PI is %f.' % pi)  # 默认保留小数点后 6 位
    print('PI is %.2f.' % pi)  # 保留小数点后 2 位
    
    3.十六进制整数格式化输出
    num = 255
    print('Number in hex is %X' % num)  # 大写字母
    print('Number in hex is %x' % num)  # 小写字母
    
    4.八进制整数格式化输出
    num = 64
    print('Number in octal is %o' % num)
    
    5.科学计数法格式化输出
    num = 1.23456789e+09
    print('Number in scientific notation is %e' % num)  # 默认保留小数点后 6 位
    print('Number in scientific notation is %.5e' % num)  # 保留小数点后 5 位
    
    6.输出结果:
        Copy CodeMy name is Alice, and I am 18 years old.
            PI is 3.141593.
            PI is 3.14.
            Number in hex is FF
            Number in hex is ff
            Number in octal is 100
            Number in scientific notation is 1.234568e+09
        Number in scientific notation is 1.23457e+09
    ps:使用%s来做字符串的格式化输出操作,传值时,必须严格按照位置与%s一一对应
    
    7.练习题:
    练习:用户输入姓名、年龄、工作、爱好 ,然后打印成以下格式
    
    ------------ info of Tony -----------
    Name  : Tony
    Age   : 22
    Sex   : male
    Job   : Teacher 
    ------------- end -----------------
    
    
    Name = input('Name:')
    Age = int(input('Age:'))
    Sex = input('Sex:')
    Job = input('Job:')
    print('-' * 12, "info of %s" % Name, '-' * 11, '\n', 'Name:%s\n Age:%d\n Sex:%s\n Job:%s\n' % (Name, Age, Sex, Job),
          '-' * 13, 'end', '-' * 17)
    
    Name = input('Name:')
    Age = int(input('Age:'))
    Sex = input('Sex:')
    Job = input('Job:')
    print('-' * 12, "info of %s" % Name, '-' * 11, '\n', 'Name:{}\n Age:%d\n Sex:{}\n Job:{}\n'.format(Name, Age, Sex, Job),
          '-' * 13, 'end', '-' * 17)

    2. 使用 format() 方法

    format() 方法使用一对花括号 {} 来表示占位符。大括号内可以包含数字、变量名或表达式等内容,用于指定替换的位置或值。如果只有一个参数,则不需要指定花括号中的数字。

    1.字符串格式化输出
    name = 'Bob'
    age = 20
    print('My name is {}, and I am {} years old.'.format(name, age))
    
    2.指定占位符的位置
    name = 'Charlie'
    age = 22
    print('My name is {0}, and I am {1} years old.'.format(name, age))  # 指定位置
    c = '面包'
    f = "{name}说:这个周六我们一起去吃{ss}吧".format(name='小狗', ss=c)
    print(f)
    
    3.指定占位符的名称
    name = 'Dave'
    age = 24
    print('My name is {n}, and I am {a} years old.'.format(n=name, a=age))  # format括号内在传参数时完全可以打乱顺序,但仍然能指名道姓地为指定的参数传值,name=‘tony’就是传给{name}
    
    4.格式化数值
    pi = 3.1415926
    print('PI is {:.2f}.'.format(pi))  # 保留小数点后 2 位
    
    5.格式化十六进制整数
    num = 255
    print('Number in hex is {:X}'.format(num))  # 大写字母
    print('Number in hex is {:x}'.format(num))  # 小写字母
    
    6.格式化八进制整数
    num = 64
    print('Number in octal is {:o}'.format(num))
    
    7.格式化科学计数法
    num = 1.23456789e+09
    print('Number in scientific notation is {:e}'.format(num))  # 默认保留小数点后 6 位
    print('Number in scientific notation is {:.5e}'.format(num))  # 保留小数点后 5 位
    
    8.输出结果:
    Copy CodeMy name is Bob, and I am 20 years old.
    My name is Charlie, and I am 22 years old.
    My name is Dave, and I am 24 years old.
    PI is 3.14.
    Number in hex is FF
    Number in hex is ff
    Number in octal is 100
    Number in scientific notation is 1.234568e+09
    Number in scientific notation is 1.23457e+09

    3. 使用 f-string

    f-string 是 Python 3.6+ 新增的字符串格式化方法。使用 f-string 时,可以在花括号内直接写变量、表达式等内容作为占位符,更加简便。

    1.字符串格式化输出
    name = 'Eric'
    age = 26
    print(f'My name is {name}, and I am {age} years old.')
    
    2.格式化数值
    pi = 3.1415926
    print(f'PI is {pi:.2f}.')  # 保留小数点后 2 位
    
    3.格式化十六进制整数
    num = 255
    print(f'Number in hex is {num:X}')  # 大写字母
    print(f'Number in hex is {num:x}')  # 小写字母
    
    4.格式化八进制整数
    num = 64
    print(f'Number in octal is {num:o}')
    
    5.格式化科学计数法
    num = 1.23456789e+09
    print(f'Number in scientific notation is {num:e}')  # 默认保留小数点后 6 位
    print(f'Number in scientific notation is {num:.5e}')  # 保留小数点后 5 位
    
    6.输出结果:
    Copy CodeMy name is Eric, and I am 26 years old.
    PI is 3.14.
    Number in hex is FF
    Number in hex is ff
    Number in octal is 100
    Number in scientific notation is 1.234568e+09
    Number in scientific notation is 1.23457e+09

    物联沃分享整理
    物联沃-IOTWORD物联网 » Python字符串(str)及其内置方法详解

    发表评论