[BangPypers] writing file with random extension to sd card using python

Sushrut Deshpande dsushrut at qvestron.com
Thu Oct 26 21:41:54 EDT 2017


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.,
dsushrut at qvestron.com
+91 9513333160



On 27 Oct 2017 00:20, at 00:20, Ajinkya Bobade <ajinkyabobade93 at 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 at python.org
>https://mail.python.org/mailman/listinfo/bangpypers


More information about the BangPypers mailing list