gpt4 book ai didi

python - 无法从python中的目录打开文件

转载 作者:行者123 更新时间:2023-11-28 22:47:38 24 4
gpt4 key购买 nike

<分区>

我写了一个小模块,它首先找到目录中的所有文件,然后合并它们。但是,我在从目录中打开这些文件时遇到了问题。我确保我的文件和目录名称是正确的,并且文件实际上在目录中。

下面是代码..

 seqdir = "results"
outfile = "test.txt"

for filename in os.listdir(seqdir):
in_file = open(filename,'r')

下面是错误..

     in_file = open(filename,'r')     
IOError: [Errno 2] No such file or directory: 'hen1-1-rep1.txt'

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com