>chr1 <_io.TextIOWrapper name='result.fa' mode='w' encoding='UTF-8'>
001、问题
[root@pc1 test4]# ls a.fa test.py [root@pc1 test4]# cat a.fa >chr1 aatt cc >chr2 ttgg ccttgg >chr3 TTCCGG cctt ccgg [root@pc1 test4]# cat test.py #!/usr/bin/python in_file = open("a.fa", "r") out_file = open("result.fa", "w") for i in in_file: i = i.strip() if i.startswith(">"): print(i, out_file) [root@pc1 test4]# python test.py >chr1 <_io.TextIOWrapper name='result.fa' mode='w' encoding='UTF-8'> >chr2 <_io.TextIOWrapper name='result.fa' mode='w' encoding='UTF-8'> >chr3 <_io.TextIOWrapper name='result.fa' mode='w' encoding='UTF-8'>
002、解决方法
[root@pc1 test4]# cat test.py #!/usr/bin/python in_file = open("a.fa", "r") out_file = open("result.fa", "w") for i in in_file: i = i.strip() if i.startswith(">"): print(i, file = out_file) ## 在此处添加 file =
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
2021-10-31 R语言中矩阵运算
2021-10-31 R语言实现计算两个向量的协方差、标准差、皮尔逊相关系数
2021-10-31 R语言统计 plink格式数据样本缺失率
2021-10-31 linux shell 统计plink格式样本缺失率
2021-10-31 plink + R PCA绘图自动设定颜色
2021-10-31 R语言实现统计 plink格式数据位点缺失率
2021-10-31 linux shell实现统计 位点缺失率