2021-10-30

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(‘hello\npython’)
print(‘hello\tpython’)
#不需要转义时,需要在前面添加,如:\;’;
print(’\’)
print(’’’)
#以原字符的方式输出,前面加r或R
print(r’\nabc’)
print(r’D:\python\day01’)
#双引号与单引号互相套用,不得重复用
#双引号里用单引号,单引号里用双引号
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))

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值