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

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -