网站 外包 版权,wordpress如何正常打开二级菜单,上海市建设工程材料网站,昆明平台开发公司while循环 1.基本循环while 条件: 循环体如果条件为真#xff0c;那么循环则执行如果条件为假#xff0c;那么循环不执行
while循环代码体现形式while 32:print(在人间) num 1 while num101: print(num) num num 1 break 终止 continue 跳出本次循环,…while循环 1.基本循环while 条件: 循环体如果条件为真那么循环则执行如果条件为假那么循环不执行
while循环代码体现形式while 32:print(在人间) num 1 while num101: print(num) num num 1 break 终止 continue 跳出本次循环,继续下次循环 条件 可以控制while循环 2.格式化输出 msg 你好%s,我是%s%(少年,meet) print(msg) %s %d %i 占位 d和i必须放入的是整型 %s是不是放任何东西 %(xx,oo) 数量要一一对应 在格式化中使用%的时候需要转义 %% 3.运算符 比较运算符 ! 算数运算符 - * / ** % // 赋值运算符 - * / // ** % a 10 b 20 a1 # a a 1 a-1 # a a - 1 a*1 # a a*1 a / 1 # a a/1 print(a) # python2中除法得到的是整数,python3中除法得到的是浮点数 a//1 # a a//1 print(a) a**1 #a a** 1 print(a) a%1 # a a%1 print(a) 成员运算符in not in msg 出口数据,健康时代,BBS的成本 s input(请输入内容:) if s not in msg: print(不在了) else: print(在了) 逻辑运算符not and or() not and or if 32 and 54: # 真 and 真 俩个都为真才是真 print(成立)if 32 or 53: # 真 or 假 也是真 只要有一个是真就是真# print(成立)if not 35: # 碰到not 就反着来 实例 not 真 就是假 print(成立)print(bool(8))print(9 and 6) 官方说明数字运算and都为真的时候取and后边的数字print(-1 and 0) # 数字and只有有一个假的,就取假的print(9 or -9) # 官方说明数字运算or都为真的时候取or前面的数字 or有一个为真就取真 4.初识编码 ascii 美国 256 没有中文 一个字节 8位 gbk 中国 中文 2字节 16位 英文 1字节 8位unicode 万国码 2个字节 16位4个字节 32位utf-8 可变编码 英文 1字节 8位欧洲 2字节 16位亚洲 3字节 24位单位转化# bit 位# bytes 字节# 1B 8bit# 1024B 1kB# 1024kB 1MB# 1024MB 1GB# 1024GB 1TB 转载于:https://www.cnblogs.com/YZL2333/p/10191936.html