码迷,mamicode.com
首页 > 编程语言 > 详细

python数据类型 字符编码 文件处理

时间:2018-04-09 00:30:51      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:span   int   ack   python3   ima   字典   git   format   star   

一、数据类型种类

字符串

数字(整型、浮点型、长整型、复数)

列表

字典

元组

集合

 

二、各种类型数据介绍

1.数字

整型 int

作用:用来表示整数类型的数据

 

浮点型 float

作用:用来表示小数类型的数据

 

长整型

只有python2中有长整型的概念,python3中没有

 

复数

>>> x=1-2j
>>> x.real
1.0
>>> x.imag
-2.0 

 

2、字符串

作用:表示字符类型的数据

定义:在单引号\双引号\三引号内,由一串字符组成

#1、strip,lstrip,rstrip
name=‘*******Jack******‘
print(name.strip(‘*‘))




#2、lower,upper
#3、startswith,endswith
#4、format的三种玩法
#5、split,rsplit
#6、join
#7、replace
#8、isdigit

 

python数据类型 字符编码 文件处理

标签:span   int   ack   python3   ima   字典   git   format   star   

原文地址:https://www.cnblogs.com/eliza/p/8747972.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!