python读文件和写入文件复习

with open("name.txt",'r') as read_file:
    for name in read_file:
        list_name = (name.split(','))
        quchong = list(set(list_name))
        with open("server_name",'w') as write_file:
            for item in quchong:
                write_file.writelines(item + '\n')

 

posted @ 2017-07-14 16:06  梦轻尘  阅读(182)  评论(0编辑  收藏  举报