随笔分类 - python
摘要:001、 >>> str1 = "abcdabaewr" ## 测试字符串 >>> import re >>> len(re.findall("a", str1)) ## 统计a出现的次数 3 >>> len(re.findall("b", str1)) ## 统计b出现的次数 2 >>> len(
阅读全文
摘要:001、 (base) root@PC1:/home/test2# ls a.fasta test.py (base) root@PC1:/home/test2# cat a.fasta ## 测试fasta文件 >gene1 myc AGCTGCCTAAGC GGCATAGCTAATCG >gen
阅读全文
摘要:001、 (base) root@PC1:/home/test2# ls a.fasta test.py (base) root@PC1:/home/test2# cat a.fasta ## 测试fasta文件 >gene1 myc AGCTGCCTAAGC GGCATAGCTAATCG >gen
阅读全文
摘要:001、 (base) root@PC1:/home/test2# ls a.fasta b.vcf test.py (base) root@PC1:/home/test2# cat a.fasta ## 测试fasta文件 >NC_000964.3 Bacillus subtilis subsp.
阅读全文
摘要:001、 (base) root@PC1:/home/test2# ls a.fasta list.txt test.py (base) root@PC1:/home/test2# head a.fasta ## 基因组fasta文件 >NC_000964.3 Bacillus subtilis s
阅读全文
摘要:001、列表中 >>> list1 = list(range(11,20)) >>> list1 ## 测试列表 [11, 12, 13, 14, 15, 16, 17, 18, 19] >>> select = [2, 3, 7] ## 索引 >>> [list1[k] for k in sele
阅读全文
摘要:001、 (base) root@PC1:/home/test2# ls a.fasta test.py (base) root@PC1:/home/test2# head a.fasta ## 测试数据 >scaffold_1 CCCGGGTAAAACGGGTCTTCAAGAAAACGCTCCTC
阅读全文
摘要:001、 (base) root@PC1:/home/test2# ls a.txt test.py (base) root@PC1:/home/test2# cat a.txt ## 测试数据 e d d f k d d e k d f j e f j (base) root@PC1:/home/
阅读全文
摘要:001、 >>> import re ## 导入re包 >>> str = "aaaabbbbccccdddaaakkkk" ## 测试字符串 >>> re.sub(r"([ab])\1+", "Q", str) ## 将多个连续的a和b替换为一个Q 'QQccccdddQkkkk' 002、 >>
阅读全文
摘要:001、 (base) root@PC1:/home/test2# ls outcome.ped test.py (base) root@PC1:/home/test2# cat outcome.ped ## 测试文件 1 G G C C G G 2 G G G C G G 3 G G C C G
阅读全文
摘要:001、 (base) root@PC1:/home/test2# cat outcome.ped ## 测试文件 1 G G C C G G 2 G G G C G G 3 G G C C G G 4 G G C C G G 5 G G C C G G 6 G G C C G G 7 G G C
阅读全文
摘要:001、 (base) root@PC1:/home/test2# ls a.fasta test.py (base) root@PC1:/home/test2# cat a.fasta ## 测试数据 >scaffold_1 CCCGGGTAAAACGGGTCTTCAAGAAAACGCTCCTCC
阅读全文
摘要:001、 (base) root@PC1:/home/test3# ls a.txt test.py (base) root@PC1:/home/test3# cat a.txt ## 测试数据 ddd ff ff jkj jj dffffffgg dgfggggg k fff iyyee (bas
阅读全文
摘要:001、 (base) root@PC1:/home/test3# ls a.txt test.py (base) root@PC1:/home/test3# cat a.txt ## 测试数据 ddd ff ff jkj jj dffffffgg dgfggggg (base) root@PC1:
阅读全文
摘要:001、字典实现 (base) root@PC1:/home/test2# ls a.fasta test.py (base) root@PC1:/home/test2# cat a.fasta ## 测试数据 >scaffold_1 CCCGGGTAAAACGGGTCTTCAAGAAAACGCTC
阅读全文
摘要:001、问题 pip install慢 002、解决方法 临时修改 在 pip install 包名 -i https://pypi.tuna.tsinghua.edu.cn/simple。 例如: pip install scipy -i https://pypi.tuna.tsinghua.ed
阅读全文
摘要:001、 (base) root@ubuntu01pc1:~# conda --version conda 4.12.0 (base) root@ubuntu01pc1:~# python --version Python 3.9.12 002、 创建python3.8环境 conda create
阅读全文
摘要:001、python中global关键字 将 局部变量升级为全局变量 (base) root@PC1:/home/test# ls test.py (base) root@PC1:/home/test# cat test.py ## 测试脚本 #!/usr/bin/python def test_f
阅读全文
摘要:001、局部变量:作用域仅限于函数内部。 (base) root@PC1:/home/test# ls test.py (base) root@PC1:/home/test# cat test.py ## 测试脚本 #!/usr/bin/python def test_fun(): ## 创建函数
阅读全文
摘要:001、 (base) root@PC1:/home/test# ls a.fasta test.py (base) root@PC1:/home/test# head a.fasta ## 测试fasta文件 >scaffold_1 CCCGGGTAAAACGGGTCTTCAAGAAAACGCTC
阅读全文

浙公网安备 33010602011771号