ValueError:剥离文件时对已关闭文件的I / O操作

时间:2017-08-19 09:04:37

标签: python-3.x

以下snipet代码会导致此错误:  ValueError:关闭文件的I / O操作。

            file = open("Groups.txt", 'r')
            lineList = [line.strip() for line in file]

            choice2 = choicebox("Which group would you like to add the children to?", "Choose a group.",
                                choices=lineList)
            file.close()

            file1 = open('%s.txt' % choice2, 'a')
            file.write(str(file1) + "\n")
            file.close()

0 个答案:

没有答案