【Python】学习笔记二:基本数据类型
2017-10-16 16:44
519 查看
变量
python的变量不需要提前声明,可以直接输入:>>> str = 'oliver'
此时,str已经被赋值字符串oliver,在赋值之前并没有提前定义与事先声明
打印值
>>> print(str) oliver
看其数据类型
>>> print(type(str)) <class 'str'>
type()是python内置的数据类型,可以用来查看变量的数据类型
回收变量名
如果想给str赋值为数字,那么简单,直接赋值即可>>> str = 3 >>> print(str,type(str)) 3 <class 'int'> >>>
基本数据类型
a = 10 # int类型b = 3.14 # float类型
c = False #Boolean类型
d = 'Hello world'(或者”Hello world”) #字符串
相关文章推荐
- Python 学习笔记1-基本数据类型
- Python3 学习笔记3_基本数据类型_20180222
- Python3学习笔记:基本数据类型
- python 入门学习笔记之基本语法与基本数据类型
- Python学习笔记(二):基本数据类型及操作(逻辑、字符串、浮点、复数)
- python3 入门 个人学习笔记 基本数据类型
- python学习笔记-(2)Python的基本数据类型
- Python源码学习笔记(1 基本数据类型)
- Python学习笔记之基本数据类型
- Python学习笔记(4)-基本的数据类型
- python学习笔记之-基本数据类型
- python学习笔记2-基本数据类型
- 【python学习笔记二】基本数据类型
- Python学习笔记 day02 基本数据类型
- Python3学习笔记-基本数据类型
- Python学习笔记一:数据类型与基本操作
- python学习笔记(一) 基本数据类型及运算
- Python的入门与进阶的学习笔记之Python基本数据类型
- Python3学习笔记03-基本数据类型、序列、运算及缩进和选择
- Oracle 基本数据类型 - Oracle 学习笔记 2