How do i make a while loop so it reads through every single line in .txt file before it decide what to?
问题 Im creating a function called addingcustomer(n): so i need it to read through every single line in the .txt to make sure there is no repeated customer name only add the new customer name: my customer.txt: [1. "Yuvin Ng”, “Columbia College”, 778] [2, “Ali”, “Douiglas College”, 77238] my current function: def addingcustomer(file_name,new_name): f=open(file_name,"r+") for line in f: while new_name in line: return ("The Customer existed") while new_name not in line: f=open("file_name","w") f