def save_pseudonyms(): fn = os.path.abspath("pseudonyms.csv") print("Saving %d unique NHS Number pseudonyms to %s" % (len(LOOKUP), fn)) f = open(fn, "w") f.write("Real_NHS_Number,Pseudonym_NHS_Number\n") for nhs_number in LOOKUP.keys(): f.write("%d,%d" % (nhs_number, LOOKUP[nhs_number]) + "\n") main()