Python把文件中的数据写入

问题相关代码,请勿粘贴截图

Traceback (most recent call last):
File "D:/PycharmProjects/learn_pytorch/11111111.py", line 67, in
list_file.write(r'C:\Users\dell\Desktop\yolov5-master\VOCData\images\%s.jpg\n' % (image_id))
io.UnsupportedOperation: not writable

这一块怎么修改呢

把代码发出来

for image_id in image_ids:
    list_file.write('C:/Users/dell/Desktop/yolov5-master/VOCData/images/%s.jpg\n'%(image_id))
    convert_annotation(image_id)
list_file.close()