I think you shud open file as binary write and try to write the integer after 
converting it to utf-8

Best Regards,
Sushrut Deshpande
Founder - Qvestron Systems Pvt. Ltd.,
dsush...@qvestron.com
+91 9513333160



On 27 Oct 2017 00:20, at 00:20, Ajinkya Bobade <ajinkyabobad...@gmail.com> 
wrote:
>Hello,
>This is my first question on this forum point me in a right way if I
>posted
>in a wrong place. That aside I am trying to write a file with '.bag
>' extension to sd card( .bag is used in Ross programming).
>
>I wrote a code to write a simple integer to disk as shown
>
>
>file = open("/path/to/file", 'w')
>x = 1
>
>while True:
>    x = x + 1
>    print(x)
>    file.write(str(x))
>    file.flush()
>
>in this code I could not write file.write(x). Why is this?If I want to
>store a file(' as it is') on this disk without converting it into
>string
>what should I do?
>_______________________________________________
>BangPypers mailing list
>BangPypers@python.org
>https://mail.python.org/mailman/listinfo/bangpypers
_______________________________________________
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers

Reply via email to