摘要: 001、 #include <stdio.h> int main(void) { int i; puts("please input an positive num."); printf("i = "); scanf("%d", &i); while (i > 0) { printf("%d", i 阅读全文
posted @ 2022-08-12 22:04 小鲨鱼2018 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 001、c语言中字符常量用单引号括起来, 用putchar函数输出。 字符常量是 int类型。 字符常量为什么是int型? #include <stdio.h> int main(void) { int i; for (i = 1; i <= 5; i++) { putchar('*'); ## 单 阅读全文
posted @ 2022-08-12 20:48 小鲨鱼2018 阅读(446) 评论(0) 推荐(0) 编辑
摘要: 001、 >>> dict1 = {"d":400, "a":300, "e":500, "b":700, "c":600} ## 测试字典 >>> dict1 {'d': 400, 'a': 300, 'e': 500, 'b': 700, 'c': 600} >>> sorted(dict1.k 阅读全文
posted @ 2022-08-12 20:15 小鲨鱼2018 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 001、 >>> test = [10, 20, 10, 30, 30, 10, 40, 10, 30] ## 测试列表 >>> from collections import Counter as ct ## 借助Counter函数实现 >>> ct(test) Counter({10: 4, 3 阅读全文
posted @ 2022-08-12 17:33 小鲨鱼2018 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 001、 >>> import re >>> str = "sefderfhjuynb" >>> re.findall(".{3}", str) ## 步长为3 ['sef', 'der', 'fhj', 'uyn'] >>> re.findall(".{2}", str) ## 步长为2 ['se 阅读全文
posted @ 2022-08-12 17:19 小鲨鱼2018 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 001、 root@PC1:/home/test2# ls test.py root@PC1:/home/test2# cat test.py ## 测试程序 #!/usr/bin/python out_file = open("result.txt", "w") for i in range(1, 阅读全文
posted @ 2022-08-12 16:41 小鲨鱼2018 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 001、 continue表示跳过后面的程序,重新循环,而pass表示站位,什么也不做,后面的代码(else之前)还是会执行, 好多情况下是没有想清楚这部分应该怎么写,所以先用pass站位,能让程序顺利跑起来。等想好这部分怎么写了,再替换掉pass部分 root@PC1:/home/test2# l 阅读全文
posted @ 2022-08-12 15:57 小鲨鱼2018 阅读(328) 评论(0) 推荐(0) 编辑
摘要: 001、首个字符查找 >>> seq = 'ATGTGACCCTGATTTTGAATGatgAtgAtGaTGaTg' ## 测试字符串 >>> seq.find('ATG') ## 字符串内建函数find返回第一个匹配字符的索引 0 >>> seq.find('GAC') 4 >>> seq.fi 阅读全文
posted @ 2022-08-12 14:32 小鲨鱼2018 阅读(455) 评论(0) 推荐(0) 编辑
摘要: 001、 (base) root@PC1:/home/test2# ls a.fasta test.py (base) root@PC1:/home/test2# cat a.fasta ## 测试fasta文件 >OR4F5_ENSG00000186092_ENST00000641515_61_1 阅读全文
posted @ 2022-08-12 13:30 小鲨鱼2018 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 001、 fasta序列迭代 (base) root@PC1:/home/test2# cat a.fasta ## 测试fasta文件 >gene1 myc AGCTGCCTAAGC GGCATAGCTAATCG >gene2 jun ACCGAATCGGAGCGATG GGCATTAAAGATC 阅读全文
posted @ 2022-08-12 12:39 小鲨鱼2018 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 001、 #include <stdio.h> int main(void) { printf("!0 = %d\n", !0); // !+ 0, 返回1 printf("!5 = %d\n", !5); printf("!-3 = %d\n", !-3); // ! + 非0, 返回0 retu 阅读全文
posted @ 2022-08-12 01:01 小鲨鱼2018 阅读(1041) 评论(0) 推荐(0) 编辑
摘要: 001、 #include <stdio.h> int main(void) { int i; do { puts("0: stone; 1: scissors; 2: colth"); printf("i = "); scanf("%d", &i); if(i > 2 || i <0) { put 阅读全文
posted @ 2022-08-12 00:56 小鲨鱼2018 阅读(393) 评论(0) 推荐(0) 编辑
摘要: 001、 #include <stdio.h> int main(void) { int i; do { int random; printf("random = "); scanf("%d", &random); if (random % 2) { puts("odd"); } else { pu 阅读全文
posted @ 2022-08-12 00:42 小鲨鱼2018 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 001、 #include <stdio.h> int main(void) { int i; printf("i = "); scanf("%d", &i); switch(i % 3) ## 条件 { case 0: puts("can be devided by 3."); break; ## 阅读全文
posted @ 2022-08-12 00:13 小鲨鱼2018 阅读(119) 评论(0) 推荐(0) 编辑