Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8180739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:17:13+00:00 2026-06-07T00:17:13+00:00

Python 3 really complicated the whole file reading process, when you have a binary

  • 0

Python 3 really complicated the whole file reading process, when you have a binary file with some strings in it.

I can do string.decode('ascii') when I’m sure what I read is ascii text, but in my file I have strings with null ('\x00') terminated strings I must read an convert to list of strings.
How would be the new way to do it, without going byte-by-byte and checking if it’s a null or not?

mylist = chunkFromFile.split('\x00')

TypeError: Type str doesn't support the buffer API
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:17:16+00:00Added an answer on June 7, 2026 at 12:17 am

    I’m guessing that chunkFromFile is a bytes object. Then you also need to provide a bytes argument to the .split() method:

    mylist = chunkFromFile.split(b'\x00')
    

    See:

    >>> chunkFromFile = bytes((123,45,0,67,89))
    >>> chunkFromFile
    b'{-\x00CY'
    >>> chunkFromFile.split(b'\x00')
    [b'{-', b'CY']
    >>> chunkFromFile.split('\x00')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: Type str doesn't support the buffer API
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created some Python code which is really complicated but it basically asks
I have some really nice Python code to do what I need to do.
Have you ever heard of really working python-libraries for the realization of the SMPP
I have these really complicated data files that I have processed and as each
I'm writing some views in Django, the are just python functions really. I'm curious
I'm new to python so I really don't know the language very well. the
At this time Textmate's official Python bundle is really bare bones, especially in comparison
I've been using arrays lately and really missing Python's in operator. e.g.: if (hello
I really thought I understood Python variable referencing, so I'm confused why this code
I really love working with Django and Python, when I go back to PHP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.