Python Day01
#打印各种数据
print(‘hello,world’)
print(‘123,3.5,true’)
print(‘人生苦短,我用python’)#控制台输出内容
#控制是否换行 (end=’’) (print默认是换行的)
print(“hello “,end=’’)
print(‘world’)
#转义字符
#n 换行
#t Tab键,相当于4个空格,以4个为单位,跳到下一个tab位置
print(‘hellonpython’)
print(‘hellotpython’)
#不需要转义时,需要在前面添加,如:;’;
print(’’)
print(’’’)
#以原字符的方式输出,前面加r或R
print(r’nabc’)
print(r’D:pythonday01’)
#双引号与单引号互相套用,不得重复用
#双引号里用单引号,单引号里用双引号
print(‘小明对妈妈说:“我饿了!”’)
#python支持各种特殊符号
print(‘hello’,‘python’)
#注释:
#单行注释 :#+文字
#多行注释 :三个引号
‘’’
多行注释
‘’’
“””
多行注释
“””
#变量
#数据类型
#整型 int
#Python中不用指出数值类型
age=16
print(age,type(age),id(age))
#其他进制表示
i=0b100#二进制以0b开头
i2=0o10#八进制以0o开头
i3=0x10#十六进制以0x开头
#浮点型 float
price=12.8
price(price,type(price))
#bool
flag=True
print(flag,type(flag))
agr=15
print(‘我的名字’+str(agr))



