python简明教程——2017年12月8日

1.反斜线\可以在多个物理行中写一个逻辑行。

2.制表符(tab)、空格可以用来缩进,但是空格适用性大。可以使用单个tab或2个或4个空格,只用一种,养成习惯,关键是制表符和空格不能混用

3编译型语言执行效率优于解释型,因为编译器在编译过程中会根据不同平台自动优化目标代码,且特点为1次编译,N次运行

4-25.5%2.25=-12*2.25+1.5,余数为1.5;25.5%2.25=11*2.25+0.75,余数为0.75

5Python解释器在做布尔运算时,只要能提前确定计算结果,它就不会往后算了,直接返回结果,称为短路计算。

6格式化方法

1 age = 20
2 name = 'Swaroop'
3 
4 print('{0} was {1} years old when he wrote this book'.format(name, age))
5 print('Why is {0} playing with python'.format(name))
1 age = 22
2 name = 'akayi'
3 print(name + ' is ' + str(age) + ' years old')
1 age = 22
2 name = 'akayi'
3 print('{} is {} years old when he started learned python'.format(name, age))
4 print('why is {} ?'.format(name))

 

转载于:https://www.cnblogs.com/czlm/p/8004546.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值