上一页 1 ··· 285 286 287 288 289 290 291 292 293 ··· 367 下一页
摘要: python中查找字符串中字符出现的次数 1、 >>> test1 = "absacaxy" >>> test1.count("a") 3 >>> test1.count("a",0,4) ## 设置查找范围 2 2、统计所有字符出现的次数 >>> test1 = "abdeaceb" >>> a 阅读全文
posted @ 2021-05-01 21:27 小鲨鱼2018 阅读(2029) 评论(0) 推荐(0) 编辑
摘要: 1、 删除左边空白 >>> test1 = " abcd " >>> test1 ' abcd ' >>> test1.lstrip() 'abcd ' 2、删除右边空白 >>> test1 ' abcd ' >>> test1.rstrip() ' abcd' 3、删除两边空白 >>> test1 阅读全文
posted @ 2021-05-01 21:20 小鲨鱼2018 阅读(687) 评论(0) 推荐(0) 编辑
摘要: 1、大写改为小写 >>> test1 = "abCDEfg" >>> test1 'abCDEfg' >>> test1.upper() 'ABCDEFG' 2、小写变大写 >>> test1 'abCDEfg' >>> test1.lower() 'abcdefg' >>> test1 'abCD 阅读全文
posted @ 2021-05-01 21:14 小鲨鱼2018 阅读(667) 评论(0) 推荐(0) 编辑
摘要: python中zip函数 1、python中zip函数用于返回由可迭代参数共同组成的元组。 长度不一致时,以短的序列进行迭代。 >>> test1 = ["aaa","bbb","ccc","ddd"] >>> test2 = (111,222,333,444,555) >>> test3 = "a 阅读全文
posted @ 2021-05-01 20:44 小鲨鱼2018 阅读(596) 评论(0) 推荐(0) 编辑
摘要: python中enumerate函数。 1、python中enumerate函数 enumerate函数的应用对象为序列(列表、元组、字符串), 返回一个由二元组组成的可迭代对象,二元组由可迭代参数的索引号及其对应的元素组成。 列表 >>> test1 = ["aaa","bbb","ccc"] > 阅读全文
posted @ 2021-05-01 20:37 小鲨鱼2018 阅读(558) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int i, j, k, a[2][4][3], b[4][3] = {}; for(i = 0; i < 2; i++) { for(j = 0; j < 4; j++) { for(k = 0; k < 3; k++) 阅读全文
posted @ 2021-05-01 18:26 小鲨鱼2018 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int i, j, a[8][3] = {}; puts("please input the scores of the students."); for(i = 0; i < 6; i++) { for(j = 0; j 阅读全文
posted @ 2021-05-01 17:30 小鲨鱼2018 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 求3行4列矩阵和4行5列矩阵的乘积。 1、 #include <stdio.h> int main(void) { int i, j, k, a[3][4], b[4][5], c[3][5] = {0}; puts("please input the elements of matrix a.") 阅读全文
posted @ 2021-05-01 12:42 小鲨鱼2018 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 1、 #include <stdio.h> int main(void) { int i, j, a[6][2]; for(i = 0; i < 6; i++) { for(j = 0; j < 2; j++) { printf("a[%d][%d] = ", i, j); scanf("%d", 阅读全文
posted @ 2021-04-30 23:54 小鲨鱼2018 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 求4行3列矩阵和3行4列矩阵的乘积。各构成元素的值从键盘输入。 1、 #include <stdio.h> int main(void) { int i, j, k, a[4][3], b[3][4], c[4][4] = {0}; puts("input the elements of 4 row 阅读全文
posted @ 2021-04-30 22:57 小鲨鱼2018 阅读(526) 评论(0) 推荐(1) 编辑
上一页 1 ··· 285 286 287 288 289 290 291 292 293 ··· 367 下一页