Answers for "file handling in python append byte"

0

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
Posted by: Guest on July-22-2020

Code answers related to "file handling in python append byte"

Python Answers by Framework

Browse Popular Code Answers by Language