Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python save input to text file

#Simple Mood Diary Script As An Example#

print('My Mood Diary')
mood = input('How are you feeling today? ')
#Saves the input as the variable 'mood'#
text_file = open("MoodDiary.txt", "w")
#Opens or creates the .txt file, sharing the directory of the script#
text_file.write(mood)
#Writes the variable into the .txt file#
text_file.close()
#Closes the .txt file#
Comment

PREVIOUS NEXT
Code Example
Python :: opencv save image rgb 
Python :: python if else variable assignment 
Python :: pyqt tex 
Python :: python get name of tkinter frame 
Python :: create directory in python 
Python :: python time function duration and memory usage 
Python :: static dirs django 
Python :: pytorch save model 
Python :: run python script from c# 
Python :: how to change the title of a tkinter widnow 
Python :: how to reapete the code in python 
Python :: python exceute 60 records per minute counter 
Python :: python define 2d table 
Python :: create sqlite database python 
Python :: read_csv Unnamed: 0 
Python :: python if not path exist make path 
Python :: python create folder if not exists 
Python :: python change cwd to script directory 
Python :: how to multiply two tuples in python 
Python :: python pearson correlation 
Python :: finding the format of an image in cv2 
Python :: tkinter gui grid and frame 
Python :: hypixel main ip 
Python :: how to pick a random number in a list python 
Python :: python dictionary dot product 
Python :: delete a row in pandas dataframe 
Python :: remove last element from dictionary python 
Python :: Violin Plots in Seaborn 
Python :: timestamp in python 
Python :: Socket Programming Client Side 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =