python으로 list를 line-by-line으로 read와 write하자.
해결:
def read_list_linebyline(fname): with open(fname) as fid: content = fid.readlines() content = [item.rstrip('\n') for item in content] return content
def write_list_linebyline(fname, thelist): fid = open(fname, 'w') for item in thelist: fid.write('%s\n' % (item)) fid.close()