Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: File type (mode)
Post: RE: File type (mode)

(Aug-29-2021, 02:31 AM)bowlofred Wrote: No, text mode filehandles will not cope with your binary data. with open("somedata.bin", "wt") as f: f.write(b'hello') # Throws TypeError. Can't send...
rayleiter General Coding Help 5 2,100 Aug-29-2021, 04:08 PM
    Thread: File type (mode)
Post: RE: File type (mode)

(Aug-28-2021, 07:40 PM)bowlofred Wrote: You'll almost certainly want to open the file in binary mode and then control any text data by explicitly encoding it yourself into whatever is necessary.Than...
rayleiter General Coding Help 5 2,100 Aug-28-2021, 09:31 PM
    Thread: File type (mode)
Post: File type (mode)

If I want to create a file which contains both ASCII Text AND Binary data, which mode is best to use when creating the file ("wt" OR "wb")? or perhaps some other mode? Thanks Ray
rayleiter General Coding Help 5 2,100 Aug-28-2021, 06:43 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020