Codecademy学习Python

1:Python语法中变量的使用不须要声明,且任意变量能够相互(强制)转换;spa

2:语句结束不须要使用分号";";字符串

3:Variables,numbers,booleans,string ,list .Whitespace,Comments,数学运算:+,-,*,/,%,**(求幂);数学

4:单行注释用#,多行注释用"""  """;string

5输出跟c语言不一样。c语言是print("%.2f",d);Python是print("%.2f"  %d)  ;it

6:用缩进来表示层次关系;变量

7:String 的method:  str(),len(),  其余数据格式也能用 lower(),upper(); 只是String数据能用;语法

8:Python中冒号的使用:if后面要用冒号,if a>3: 方法

9:截取字符串的方法“abc"[1:2];数据