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 + '
')
原文地址:https://www.cnblogs.com/uglyliu/p/7170919.html