私のファイルは、次の内容の「xml.txt」です。
books.xml
news.xml
mix.xml
readline() 関数を使用すると、すべてのファイルの名前に "\n" が追加されます。これは、xml.txt に含まれるファイルを開きたいため、エラーになります。私はこれを書きました:
fo = open("xml.tx","r")
for i in range(count.__len__()): #here count is one of may arrays that i'm using
file = fo.readline()
find_root(file) # here find_root is my own created function not displayed here
このコードの実行時にエラーが発生しました:
IOError: [Errno 2] No such file or directory: 'books.xml\n'