Hello Everyone,

I try below code in python 2.7.10 to first create and write into a file and
then read and write that file but what i get is just a  file with new
content.


>>> with open('test.txt', 'wb+') as f:
...     f.write('this is test file.')
...     f.write('ok!!!')
...
>>> with open('test.txt', 'wb+') as f:
...     a_str = f.read() + 'read the file'
...     f.seek(0)
...     f.write(a_str)
...


I have read in documentation that wb+ mode is for writing and reading. Am i
using wrong mode, should i use rb+ ?

Thanks and regards,
Anshu
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to