Lists Explain the split() and for and if function in this code
fname = input("Enter file name: ") fh = open(fname) lst = list()enter code here for line in fh:enter code here for word in line.split(): if word in lst: continue else: lst.append(word) lst.sort() print(lst)
Aucun commentaire:
Enregistrer un commentaire