Suleman Jaffar Suleman Jaffar - 5 months ago 33
Python Question

Saving from python to an Excel

For example, when it generates the random number, I want it to save the number on to a different file in the same folder.

Answer

You just need to create a text file in which the values are separated by commas.

Try this:

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)
Comments