Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

append a line to a text file python

# Open a file with access mode 'a'
file_object = open('sample.txt', 'a')
 
# Append 'hello' at the end of file
file_object.write('hello')
 
# Close the file
file_object.close()
Source by thispointer.com #
 
PREVIOUS NEXT
Tagged: #append #line #text #file #python
ADD COMMENT
Topic
Name
9+6 =