Python Forum
supporting both str and bytes on write file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
supporting both str and bytes on write file
#5
(Jul-07-2022, 07:24 AM)Gribouillis Wrote: You can easily create one by wrapping a file opened in mode 'wb' in your own class. Just overload the write() method.
so, basically, i just create my own file-like class to do what i need. if i included read methods, i would need to add a means to specify which type the caller wants returned (such as an arg given at read or open time, or distinct method names).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: supporting both str and bytes on write file - by Skaperen - Jul-07-2022, 11:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  supporting both strings and bytes in functions Skaperen 0 1,944 Nov-28-2019, 03:17 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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