Python Forum
to strings or to bytes, that is the question
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
to strings or to bytes, that is the question
#1
when i convert control character representation to what it represents, should a function that does this return a string or return bytes (in python3)?

convertcc('^'+'M'+'\\'+'n') -> '\r\n'
vs
convertcc('^'+'M'+'\\'+'n') -> b'\r\n'
?
Tradition is peer pressure from dead people

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


Possibly Related Threads…
Thread Author Replies Views Last Post
Question bytes and strings Skaperen 0 738 Aug-28-2023, 02:58 AM
Last Post: Skaperen
  supporting both strings and bytes in functions Skaperen 0 1,395 Nov-28-2019, 03:17 PM
Last Post: Skaperen
  print a list strings is fast but printing the joined strings is slow Skaperen 9 3,910 Aug-26-2019, 07:48 PM
Last Post: Skaperen
  mixing bytes with strings Skaperen 3 2,390 May-29-2019, 02:30 AM
Last Post: heiner55

Forum Jump:

User Panel Messages

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