Re: open: 'ascii', 'backslashreplace' not behaving as expected - why?
Veek M <[email protected]>
| Newsgroups | comp.lang.python |
|---|---|
| Organization | A noiseless patient Spider |
| Message-ID | <[email protected]> |
On Sat, 8 Aug 2026 01:19:32 -0000 (UTC), Lawrence D’Oliveiro wrote: > b'\xef\xbf\xbf\n'.decode() Could you explain how it works and what exactly is going on? fh.readline() returns a unicode string with the funny chars (bytes 0xff 0xff) encoded as \\xef \\xbf \\xbf - why is it \\? why not just use a single u'\xef\xbf\xbf' - why is he escaping the '\'. Also - how exactly is he getting ef bf bf and not ff ff?