微网站建设86215,宜城网站建设网络推广,网站主体负责人是法人,企业建设网站公司名称大全目录
一.Python str 函数介绍二.Python str 函数使用三.猜你喜欢 零基础 Python 学习路线推荐 : Python 学习目录 Python 基础入门 一.Python str 函数介绍
在 Python 中 str 即可以表示 字符串 str 类型#xff0c;也可以作为一个内置函数#xff0c;可以直接将…目录
一.Python str 函数介绍二.Python str 函数使用三.猜你喜欢 零基础 Python 学习路线推荐 : Python 学习目录 Python 基础入门 一.Python str 函数介绍
在 Python 中 str 即可以表示 字符串 str 类型也可以作为一个内置函数可以直接将其他数据类型强制转为字符串类型语法如下 参数object — python数据类型对象返回值: 返回一个str类型的变量
str(object)二.Python str 函数使用
# !usr/bin/env python
# !usr/bin/env python
# -*- coding:utf-8 _*-Author:猿说编程
Blog(个人博客地址): www.codersrc.com
File:Python str 函数.py
Time:2021/04/20 07:37
Motto:不积跬步无以至千里不积小流无以成江海程序人生的精彩需要坚持不懈地积累# 案例1: 将整形或者浮点数类型转为str字符串类型
print(type(str(3.5)))
print(str(3.5))
print(****20)# 案例2: 将字典转为str字符串类型
dict1 {www: shuopython.com, google: google.com}
print(type(str(dict1)))
print(str(dict1))
print(****20)# 案例3: 将列表转为str字符串类型
list1 [1, 2, 3, 4]
print(type(str(list1)))
print(str(list1))
输出结果class str
3.5
************************************************************
class str
{www: shuopython.com, google: google.com}
************************************************************
class str
[1, 2, 3, 4]三.猜你喜欢
Python for 循环Python 字符串Python 列表 listPython 元组 tuplePython 字典 dictPython 条件推导式Python 列表推导式Python 字典推导式Python 函数声明和调用Python 不定长参数 *argc/**kargcsPython 匿名函数 lambdaPython return 逻辑判断表达式Python 字符串/列表/元组/字典之间的相互转换Python 局部变量和全局变量Python type 函数和 isinstance 函数区别Python is 和 区别Python 可变数据类型和不可变数据类型Python 浅拷贝和深拷贝
未经允许不得转载猿说编程 » Python str 函数