How do I take Someone's name in Python and create a file to write to with that name? -


i bit new python, , trying simple i'm sure. want ask name initial raw_input , want name used create file. additional raw_input taken user gets recorded file.

raw_input("what name?") file = open("newfile.txt", "w")  

i have above code create file called newfile.txt, how can make requested name used file name? thank you!

file = open("user.txt", "w") 

save name in variable , use :

name = raw_input("what name?") file = open(name+".txt", "w")  ... file.close() 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -