随笔分类 -  python

上一页 1 2 3 4 5 6 7 8 9 ··· 26 下一页
摘要:001、python报错 >>> dict1 = {"aa":300, "bb":500, "cc":400, "dd":700} >>> dict1 {'aa': 300, 'bb': 500, 'cc': 400, 'dd': 700} >>> dict1.keys() dict_keys([' 阅读全文
posted @ 2023-06-02 13:05 小鲨鱼2018 阅读(659) 评论(0) 推荐(0)
摘要:001、python报错如下: >>> dict1 = {"aa":700, "bb":400, "cc":300, "dd":600} >>> dict1.values().index(300) Traceback (most recent call last): File "<stdin>", 阅读全文
posted @ 2023-06-02 12:58 小鲨鱼2018 阅读(185) 评论(0) 推荐(0)
摘要:001、 >>> dict1 = {"aa":500, "bb":400, "cc":700, "dd":300} >>> dict1 {'aa': 500, 'cc': 700, 'dd': 300, 'bb': 400} >>> dict1.keys()[dict1.values().index 阅读全文
posted @ 2023-06-02 00:27 小鲨鱼2018 阅读(34) 评论(0) 推荐(0)
摘要:两者都返回首次匹配字符串的索引,re.match函数只从头开始匹配, re.search函数不限制只从头开始匹配。 001、re.match函数 [root@PC1 test2]# python3 Python 3.10.9 (main, Mar 1 2023, 18:23:06) [GCC 11. 阅读全文
posted @ 2023-05-31 13:03 小鲨鱼2018 阅读(210) 评论(0) 推荐(0)
摘要:001、 [root@PC1 test3]# ls a.txt [root@PC1 test3]# cat a.txt ## 测试文件 10 2 3 0 3 6 6 12 1 1 5 1 2 2 2 4 2 26 8 3 33 34 5 3 [root@PC1 test3]# python ## 启 阅读全文
posted @ 2023-05-16 23:54 小鲨鱼2018 阅读(231) 评论(0) 推荐(0)
摘要:001、 [root@PC1 ~]# pip config list 002、 [root@PC1 ~]# cd ~ [root@PC1 ~]# ls -a . .bash_history .bashrc .cshrc Documents .ICEauthority Music Public .tc 阅读全文
posted @ 2023-05-16 01:07 小鲨鱼2018 阅读(858) 评论(0) 推荐(0)
摘要:python2.7中安装pip命令 001、 [root@PC1 test]# pip bash: pip: command not found... 002、 [root@PC1 test]# cat /etc/redhat-release 003、 [root@PC1 software]# cu 阅读全文
posted @ 2023-05-15 13:20 小鲨鱼2018 阅读(65) 评论(0) 推荐(0)
摘要:001、 >>> import re >>> tmp = re.match(r'^([^\s]+)\s(.*)', "ab cd") >>> tmp <re.Match object; span=(0, 5), match='ab cd'> >>> tmp.group(1) 'ab' >>> tmp 阅读全文
posted @ 2023-05-09 22:57 小鲨鱼2018 阅读(111) 评论(0) 推荐(0)
摘要:001、re.match >>> re.match("ab", "abcdefgab") ## 在字符串abcdefgab中查找字符串ab, 返回索引 <re.Match object; span=(0, 2), match='ab'> >>> re.match("xy", "abcdefgab") 阅读全文
posted @ 2023-05-09 20:48 小鲨鱼2018 阅读(414) 评论(0) 推荐(0)
摘要:001、 (base) [root@PC1 test3]# ls ## 测试数据及脚本 a.txt test.py (base) [root@PC1 test3]# cat test.py ## 复制程序 import os os.popen('cp a.txt b.txt') ## windows 阅读全文
posted @ 2023-03-22 21:27 小鲨鱼2018 阅读(97) 评论(0) 推荐(0)
摘要:001、python报错 SyntaxError: Non-ASCII character '\xe8' in file test.py on line 6 原因:注释行中出现了中文 ,而python支持的ASCII码不支持中文。 002、解决方法 在头文件中增加: # -*- coding: ut 阅读全文
posted @ 2023-02-27 09:29 小鲨鱼2018 阅读(868) 评论(0) 推荐(0)
摘要:001、 方法1 >>> list1 = [] >>> for i in range(5): ... list1.append("value") ... >>> list1 ['value', 'value', 'value', 'value', 'value'] 002、方法2 >>> list1 阅读全文
posted @ 2023-02-26 18:02 小鲨鱼2018 阅读(318) 评论(0) 推荐(0)
摘要:001、 [root@PC1 test]# ls outcome.map test.py [root@PC1 test]# cat outcome.map ## 测试数据 55910 85204 jj 122948 yy kk 203750 rr ee ss 312707 dd ff 356863 阅读全文
posted @ 2023-01-07 23:47 小鲨鱼2018 阅读(88) 评论(0) 推荐(0)
摘要:001、查看系统 [root@PC1 ~]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) 002、安装环境依赖 yum -y install gcc install zlib zlib-devel bzip2-devel 阅读全文
posted @ 2023-01-02 23:05 小鲨鱼2018 阅读(791) 评论(0) 推荐(0)
摘要:001、python3.11编译报错 /home/software/python/Modules/_ctypes/_ctypes.c:118:17: fatal error: ffi.h: No such file or directory 002、解决方法 [root@PC1 python]# y 阅读全文
posted @ 2023-01-02 13:19 小鲨鱼2018 阅读(1711) 评论(0) 推荐(0)
摘要:001、 问题 >>> from Bio import SeqIO 002、解决方法 pip3 install biopython -i https://pypi.douban.com/simple 003、测试效果 from Bio import SeqIO 阅读全文
posted @ 2022-11-19 22:57 小鲨鱼2018 阅读(1464) 评论(0) 推荐(0)
摘要:001、 [root@pc1 test2]# ls a.txt test.py [root@pc1 test2]# cat a.txt ## 测试序列 AGCTTCCCC [root@pc1 test2]# cat test.py ## 测试程序 #!/usr/bin/python in_file 阅读全文
posted @ 2022-11-16 18:21 小鲨鱼2018 阅读(199) 评论(0) 推荐(0)
摘要:001、match >>> import re >>> str1 = "www.baidu.com" ## 测试字符串 >>> re.match("www", str1) <re.Match object; span=(0, 3), match='www'> >>> re.match("www", 阅读全文
posted @ 2022-11-16 16:21 小鲨鱼2018 阅读(30) 评论(0) 推荐(0)
摘要:001、shell实现 [root@pc1 test2]# ls a.txt [root@pc1 test2]# cat a.txt ## 测试数据 a 8 b 3 a 9 a 2 b 3 c 7 c 2 c 10 [root@pc1 test2]# for i in a b c; do grep 阅读全文
posted @ 2022-11-16 11:16 小鲨鱼2018 阅读(179) 评论(0) 推荐(0)
摘要:001、 >>> list1 = [("aa",100, 400), ("bb", "kk", "yy"), (33, 400, 500)] >>> for i, j, k in list1: ## 利用列表、元组同时传入多个参数 ... print(i,k) ... aa 400 bb yy 33 阅读全文
posted @ 2022-11-15 23:45 小鲨鱼2018 阅读(268) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 ··· 26 下一页