Python基础总结

1、Python的发展历史 

    龟叔 Guido van Rossum  1989年在圣诞节期间诞生

    其特点:简单、明确、优雅

    Python是解释型语言  是编译型语言

2、Python的基本数据类型

    布尔型 True False

    数值型 int float

        单目运算符 + - ~

        算术运算符 ** / * // % + -

        位运算符 & | ^ >> <<

        关系运算符 > >= < <= == !=

        赋值运算符 = += -+ *= /+ **= %= //=

        身份运算符 is    is not

        成员运算符 in     not in

        逻辑运算符 not and or

    所用到的函数

        int()    pow()     divmod()    abs()

    字符串(单引,双引,三引)

        字符串可以进行 + 或 *N 或 in 或 not in 

        索引  s[index] 注:0 <= index <len(s) 或 -len(s) <=index <= -1

        切片  s[start:end:step]   注:start<= index < end

    所用到的函数

        len()  max()  min()  .index()  .count()

        .format() 注:三种使用的方法  N1 = nihao 

                       N2 = hello

                          print("{  }".format(  ))

                          print("{1}{0}".format(N1,N2))

                          print("{new1}{new2}".format(new1=N,new2=N2))

3、输入和输出

    input()

    print()

4、if 条件语句

5、for 循环和 while 循环

6、break 语句和 continue 语句

    

     

原文地址:https://www.cnblogs.com/Qingxiaoyu/p/10066580.html