常用的数据类型

数据类型:

  数字:

    int(整形)

    float(浮点型)

    long(长整型)

  布尔:(True(1))和False(0)[ 真和假 ]

  字符串  str    

  列表  list

  元组 tuple

  字典 dict

  集合 set

 

type 可以查看数据类型:

例如:type(3**6)

<class 'int'>

>>> type(3.55)
<class 'float'>

 

字符串:例如 n = ‘hello word’

字符串格式化:

例如:

name = input("name:")
age = input("age:")
job = input("job:")
#print("Infomation of []:"+ name + "\nNname:[]" + name +"\nage:[]" +age +"\njob:[] +job")  这个是每一个引号是会创建一个变量
#print("Infomation of %s:\nName:%s\nage:%s\njob:%s"%(name,name,age,job))

msg='''Infomation of %s:
  name: %s
  age: %s
  job: %s
'''%(name,name,age,job)
print(msg)

 

#%d 代表数字

#%f 代表浮点数

 

posted on 2018-03-14 18:11  我丶是丿小坏蛋  阅读(145)  评论(0编辑  收藏  举报