摘要: 增:append insert append:添加到列表尾; insert:可以插入自己设置的位置。 改:直接用a[1]='内容',多项时,可以用a[1:3]=['内容1',’内容2‘] 删:remove、pop、del a.remove(a[2]),可以这样使用。 del :del a[下标],也 阅读全文
posted @ 2019-09-19 20:36 fangxs666 阅读(214) 评论(0) 推荐(0) 编辑
摘要: continue:结束本次循环,继续下一次循环。 break:终止当前整个循环 阅读全文
posted @ 2019-09-19 16:41 fangxs666 阅读(159) 评论(0) 推荐(0) 编辑
摘要: for i in list: else:#for正常循环后,会执行else rang(i,i+nk,k)=[i,i+k,i+2k,....i+nk] k:步长,默认为1,rang的范围从i到i+nk 的列表 for i range(j): 从0循环到j 阅读全文
posted @ 2019-09-19 16:08 fangxs666 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 字符串可以认为是一个list 1、重复输出 字符串后面乘数量,为多少倍字符串 print('hello'*2)#输出hello两个 2、索引操作 print('helloworld'[2:])# 打印 lloworld 3、成员运算符 in 如果字符串包含制定的字符,返回True,list也可以使用 阅读全文
posted @ 2019-09-18 20:54 fangxs666 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 一、进程管理 进程是正在运行的一个程序或命令,每一个进程都是一个运行的实体,都有自己的地址空间,并占用一定的系统资源。 二、进程管理的作用 1、判断服务器健康状态 top命令:默认每3秒更新一次。 top - 16:13:16 up 7 days, 18:08, 1 user, load avera 阅读全文
posted @ 2019-09-18 16:38 fangxs666 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 在直角三角的基础上可以修改代码实现;思想就是:确定一个行(inc_height)和列(i),每次打印一行,i从1~inc_height 变化 阅读全文
posted @ 2019-09-18 11:38 fangxs666 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 1 while True : 2 height= None 3 try : 4 height= int(input("请输入高:")) 5 except : 6 pass 7 if type(height) == int : 8 inc_height = 1 9 while inc_height<= height : 10 i=1 11 while i<=inc_height: 12 print( 阅读全文
posted @ 2019-09-17 20:43 fangxs666 阅读(586) 评论(0) 推荐(0) 编辑
摘要: ''' 用户输入长,宽,输出长*宽的长方形,用#输出 ''' #flag = True while True: width= None height= None try : height= int(input("请输入长:")) width= int(input("请输入宽:")) except : pass if type(height) == int and type... 阅读全文
posted @ 2019-09-17 19:45 fangxs666 阅读(320) 评论(0) 推荐(0) 编辑
摘要: while循环格式如下 while 条件: 语句 输出数字1~100 的偶数 #!/bin/python#输入1~100内的偶数num=1while num<=100 : if num % 2==0 : print(num) num+=1 只允许输入数字: 思想:存储输入的数字,通过type来判断是 阅读全文
posted @ 2019-09-17 15:07 fangxs666 阅读(225) 评论(0) 推荐(0) 编辑
摘要: 逻辑与:and 条件1 and 条件2 条件1和条件2必须同时为真,结果为真,其他情况都是假 或:or 条件1 and 条件2 条件1和条件2至少一个条件为真,结果为真,同时为假才是假 取反:not and or not的优先级的相同的 短路原理 条件1 and 条件2:如果条件1为假,条件2就自动 阅读全文
posted @ 2019-09-17 11:11 fangxs666 阅读(131) 评论(0) 推荐(0) 编辑