Search
 
SCRIPT & CODE EXAMPLE
 

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

PREVIOUS NEXT
Code Example
Python :: how to for loop in python stackoverflow 
Python :: init array in numpy 
Python :: pip vs conda 
Python :: str count python 
Python :: python align output 
Python :: sample hierarchical clustering 
Python :: Use len with list 
Python :: matlab .* operator in python 
Python :: joining lists python 
Python :: pivot table but keep nan 
Python :: how to avoid inserting duplicate records in orm django 
Python :: topological sort 
Python :: convert series to dataframe pandas 
Python :: double for loop in list comprehension 
Python :: get parent of current directory python 
Python :: import from parent directory python 
Python :: add legend to colorbar 
Python :: install pyimagesearch python3 
Python :: operator overloading python 
Python :: command for python shell 
Python :: discord py server.channels 
Python :: python tkinter focus on entry 
Python :: matplotlib window size 
Python :: python check if number contains digit 
Python :: show percentage in seaborn countplot site:stackoverflow.com 
Python :: summing all Odd Numbers from 1 to N 
Python :: get last item on list 
Python :: Sort index values with pandas 
Python :: Python NumPy delete Function Example 
Python :: run python file from cmd 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =