#How to add to a file #Makes use of "append" i.e. it will add to the file if #the file exists otherwise it will create hte file def main(): carval = input('Name a car:') #just ask for a list of cars from the user #then append the values to a file. Note, #I do not suggest this unless you are working with #very large files, as the file handle is open for a long period of time. #better if not too large, to read into a data structure (list) #add to the list #then flush back to file. with open('/home/isqsdac/Desktop/workspace/l3_1/carlist.txt', 'a') as f: while carval != "done": f.write(carval + '\n') carval = input('Name a car (or type done to end): ') main()