while循环,格式化输出,运算符,初始编码

1.while循环:

  while 条件:

   缩进+循环体

      while true:   # while 是关键词    true 是条件     
       print("fp is sb") # print("fp is sb是循环体

  中断循环:break和continue

    break:终止循环,跳出该循环.

    continue:终止本次循环,继续下次循环.

2.格式化输出

%s %d 指的是占位 d代表是int(整型) s代表是字符串 

前后数量必须一致.

msg = '你好%s,我是%s'%('少年','meet')
print(msg)

3.运算符

  比较运算符

    > < <= >= == !=

  赋值运算符

    += -= *= /= //= %= **=

  成员运算符

    in   not in

  逻辑运算符

    and or not

  在没有()的情况下,not的优先级高于 and ,and的优先级高于or,即优先级关系为 not >and>or

  同一优先级从左到右计算

  and :两边都为真时,选后面的.两边都为假时,选前面的.一真一假时选假的.

  or: 两边都为真时,选前面的.两边都为假时,选后面的.一真一假时选真的.

  

  算数运算符

    + - * / ** % //

4.初始编码

    asscii 美国信息交换标准代码 256个不包括中文  

                8位(bit=1字节(Byte

    gbk 中国信息交换标准代码 

      中文2字节 16位

      英文1字节 8位

    unicode 万国码

      2个字节 16位

      4个字节 32

    utf-8可变编程

      英文 1字节 8位

      欧洲 2字节 16位

      亚洲 3字节  24位

原文地址:https://www.cnblogs.com/shicongcong0910/p/10193038.html