1. 运算符号:

注意py在除法上的变革:
a = 3c = 5print(a/c)print(a//c)#0.6#0
2. 复合运算符号:
+= 例子:
price += 10#price = price + 10
*= 例子:
price *= 10#price = price * 10
等等
3.在python语言中没有 ++ 和 —:
4.字符串在python语言中:
- python不支持单字符,单字符也是当作字符串使用。
python访问子字符串,可以使用方括号来截取字符串。
str1 = 'HELLO'str2 = 'WORLD'print(str1[0])#从0开始print(str2[0:5])#注意实际上是从0开始到4,共5个字母,最后一个并不计入,中间用':'连接print(str2[:5])#当是从第一个开始时可以省略前一个。#输出:H# WORLD# WORLD
- 可以对字符串截取并对字符串连接:
str1='hello'print(str1[:5] + 'world')#输出:helloworld#注意中括号前为str1,如果漏写1会报错'type' object is not subscriptable
- 字符串运算符:

格式符字符串:与C类似
str="the string of %s include %d numbers " %('string1',len('string1'))print(str)#输出:the string of string1 include 7 numbers
