file handling in python append byte

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

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
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