Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

file handling in python append byte

file = open('myfile.dat', 'wb')
file.write('This is a sample')
file.close()

file = open('myfile.dat', 'ab')
file.seek(5)
file.write(' text')
file.close()

file = open('myfile.dat', 'rb')
print file.read()  # -> This is a sample text
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #file #handling #python #append #byte
ADD COMMENT
Topic
Name
5+5 =