file handling in python append byte

Solutions on MaxInterview for file handling in python append byte by the best coders in the world

showing results for - "file handling in python append byte"
Florencia
22 Jan 2019
1file = open('myfile.dat', 'wb')
2file.write('This is a sample')
3file.close()
4
5file = open('myfile.dat', 'ab')
6file.seek(5)
7file.write(' text')
8file.close()
9
10file = open('myfile.dat', 'rb')
11print file.read()  # -> This is a sample text