How to write a file with codepage 1252 in Python on Linux

42 Views Asked by At

how can I write a file with codepage 1252 in Python on a Raspberry Pi?

I already tried this:

    data = "Testdata"
    with open('somefile', 'w', encoding= 'cp1252') as f:
        f.write(data)

But it creates a file in the utf-8 format.

Any kind of feedback is always appreciated.

0

There are 0 best solutions below