最初状态:
'新crv和途观'
'标致 3008'
'cr-v尾翼'
合并后状态
'新crv和途观','标致 3008','cr-v尾翼'
脚本
# read data from file
with open("data_src.txt", 'rt') as src:
data = [ln.strip() for ln in src]
# distinct data and write to file with ', ' join
with open("data_sto.txt", 'wt') as sto:
sto.write(', '.join(list(set(data))))
网友评论