1.汉语及注释
#注释和多行注释
#coding=utf-8
print('hello world 你好')
#以下码是注释,不参与运行
print("="*30)
'''
这个是多行注释
'''
2.raw_input已经在python3不存在
错误:NameError: name 'raw_input' is not defined
原因出在raw_input ,python3.0版本后用input替换了raw_input
返回的类型为字符串:
3. //除法/
5/2 =2.5
5//2 = 2
5.0/2 = 2.5
5.0//2 = 2.0
4.幂方**
sublime注释为ctrl+/
5.字符串相加
6.print内不能*+操作
但是可以有普通的+-*/ ** //
7.a*=b+c 等同与a = a*(b+c)
8.if语句 浮点数和整数也可以比较
if嵌套
9.not 与or的关系
not 只与 d==18关联,不会包括or; not和or是并列的优先级
如下是一样的:
10 while 循环
11.string字符串find
str[a:]索引到结束