Python Forum
documentation for raw bytes
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
documentation for raw bytes
#1
i have a few programs to write that i could have written in C and would have had no problems.  but i started writing them in Python3 and am running into the code conversion issues because a few of the bytes are above 127 in value.  and they are not all valid UTF-8.  they do not represent Unicode characters.  they are raw bytes.  they are what they are.  but Python3 gets upset over them.  i have been trying to read the documentation on this, but it is confusing.  i need to use bytes.  but many parts of Python just don't work with raw bytes as-is.  is there a document somewhere that explains bytes and how to use them much like you would in C so i don't have to switch back to C?

for example when i have:

for line in sys.stdin:
    do_something(line)
how can i have the value of line be bytes, even with some bytes > 127?
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
documentation for raw bytes - by Skaperen - Apr-26-2017, 04:55 AM
RE: documentation for raw bytes - by nilamo - Apr-26-2017, 05:31 AM
RE: documentation for raw bytes - by Skaperen - Apr-26-2017, 06:01 AM
RE: documentation for raw bytes - by volcano63 - Apr-26-2017, 06:25 PM
RE: documentation for raw bytes - by Ofnuts - Apr-26-2017, 09:24 PM

Forum Jump:

User Panel Messages

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