Dire à Python pour enregistrer un .fichier txt à un certain répertoire sur Windows et Mac

Comment dites-vous Python où enregistrer un fichier texte?

Par exemple, mon ordinateur est en cours d'exécution le fichier Python de mon bureau. Je le veux à tout enregistrer le fichier texte dans le dossier mes documents, pas sur mon bureau. Comment dois-je faire dans un script comme celui-ci?

name_of_file = raw_input("What is the name of the file: ")
completeName = name_of_file + ".txt"
#Alter this line in any shape or form it is up to you.
file1 = open(completeName , "w")

toFile = raw_input("Write what you want into the field")

file1.write(toFile)

file1.close()
InformationsquelleAutor user1031493 | 2011-11-06