上一页 1 ··· 179 180 181 182 183 184 185 186 187 ··· 403 下一页
摘要: 001、 >>> test1 = ["aaa", 100, 200] >>> test1 ['aaa', 100, 200] >>> test2 = [str(k) for k in test1] ## 将列表test1中的数值转换为字符串 >>> test2 ['aaa', '100', '200 阅读全文
posted @ 2022-08-18 08:27 小鲨鱼2018 阅读(504) 评论(0) 推荐(0)
摘要: 001、方法1 root@PC1:/home/test# ls a.fasta test.py root@PC1:/home/test# cat a.fasta ## 测试fasta文件 >Rosalind_6404 CCTGCGGAAGATCGGCACTAGAATAGCCAGAACCGTTTCTC 阅读全文
posted @ 2022-08-18 08:17 小鲨鱼2018 阅读(118) 评论(0) 推荐(0)
摘要: 001、输出最小、最大的键或者值 >>> dict1 = {"c":800, "d":600, "a":900, "b":700} >>> dict1 {'c': 800, 'd': 600, 'a': 900, 'b': 700} >>> min(dict1) ## 输出最小的键 'a' >>> 阅读全文
posted @ 2022-08-18 08:03 小鲨鱼2018 阅读(1848) 评论(0) 推荐(0)
摘要: 001、方法1: root@PC1:/home/test# ls test.py root@PC1:/home/test# cat test.py ## 测试程序 #!/usr/bin/python out_file = open("result.txt", "w") str1 = "AAAACCC 阅读全文
posted @ 2022-08-18 07:29 小鲨鱼2018 阅读(209) 评论(0) 推荐(0)
摘要: 001、 #include <stdio.h> int count_bits(unsigned x) //此处定义函数, 用于返回任意unsigned 整型以二进制位表示时,1的总个数 { int bits = 0; while(x) { if(x & 1U) { bits++; } x >>= 1 阅读全文
posted @ 2022-08-18 03:27 小鲨鱼2018 阅读(1286) 评论(0) 推荐(0)
摘要: 001、 #include <stdio.h> int count_1(unsigned x) //此处定义一个统计unsigned int型数据用二进制位表示时所有1的个数 { int count = 0; while(x) { if(x & 1U) { count++; } x >>= 1; } 阅读全文
posted @ 2022-08-18 02:14 小鲨鱼2018 阅读(305) 评论(0) 推荐(0)
摘要: 001、 #include <stdio.h> int count_1(unsigned x) //定义统计unsigned int型数据二进制位1的个数的函数 { int count = 0; while(x) { if(x & 1U) { count++; } x >>= 1; } return 阅读全文
posted @ 2022-08-18 01:49 小鲨鱼2018 阅读(99) 评论(0) 推荐(0)
摘要: 001、 #include <stdio.h> int main(void) { unsigned int x; printf("x = "); scanf("%u", &x); // 输出整数类数据 int count = 0; while(x) { if(x & 1U) // 判断x二进制表示时 阅读全文
posted @ 2022-08-18 01:05 小鲨鱼2018 阅读(96) 评论(0) 推荐(0)
摘要: c语言中 1u表示 unsigned int 型的1. 即无符号型的整数1. & : 在c语言中表示整数类中按位操作的逻辑与运算符。(按位操作的逻辑运算符& 不同于逻辑运算符&&) unsigned x & 1U: 判断x二进制表示时末尾的数字是0还是1; 如果x的二进制位的末尾是1, 则x & 1 阅读全文
posted @ 2022-08-18 00:43 小鲨鱼2018 阅读(2893) 评论(0) 推荐(0)
摘要: 001、 (base) root@PC1:/home/test4# ls test.py (base) root@PC1:/home/test4# cat test.py ## 测试程序 #!/usr/bin/python str1 = "AGCTTTTCATTCTGACTGCAACGGGCAATA 阅读全文
posted @ 2022-08-17 23:32 小鲨鱼2018 阅读(128) 评论(0) 推荐(0)
上一页 1 ··· 179 180 181 182 183 184 185 186 187 ··· 403 下一页