For example, when it generates the random number, I want it to save the number on to a different file in the same folder.
You just need to create a text file in which the values are separated by commas.
from random import randint print("Your problem has been stored. We have allocated a case number which will be sent off to a technician. Please take a note of your case number: ", randint(0,1000000000)) with open("random.csv", "w") as fp: fp.write(#writethethingyouwanttosavehere)