Jul-12-2023, 11:45 AM
You can tell print() to print to a file.:
with open('datafile1.txt', 'a') as f: print("\nThis prints the key and its associated values") # Prints to terminal for person in data['returnData']: print(f"Elid: {person['elid']}, Last Name: {person['name']}", file=f) # Prints to file