Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

open and write in a file in python

my_file = open("C:UsersPythonfile.txt", "w")
#Give the path accurately and use 
my_file.write("This is the test text")
my_file.close()

# It is always recommended to close the file after modifying
# to see the output, open the file - file.txt
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #open #write #file #python
ADD COMMENT
Topic
Name
7+6 =