Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to write user input to a file in python

#Print User Input to A File
x = input("Enter blah : ")
y = open('C:UsersUSERNAMEDocumentsDoc1.txt', 'w')
y.write(x)

#Convert text to binary and then write to file
x = input("Enter blah : ")
y = open('C:UsersUSERNAMEDocumentsDoc1.txt', 'wb')
y.write(x)
 
PREVIOUS NEXT
Tagged: #write #user #input #file #python
ADD COMMENT
Topic
Name
4+9 =