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 5963587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:16:45+00:00 2026-05-22T19:16:45+00:00

In python, assume that there is data when I run… search = target.readframes(2205) Each

  • 0

In python, assume that there is data when I run…

search = target.readframes(2205)

Each frame consist of 2 bytes. I want to compare each 2-byte value and extract highest 2 values in the range.

For example, if the data looks like this…

0000|0001|0002|0008|0007|000F|000D|000A|00FB|00FC|00FA|00F9|00F8|00D7|00C3|0000

Then the result would extract 000F and 00FC

Could someone please help me achieve this. Any answers or helpful advise would be great.

  • 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-05-22T19:16:46+00:00Added an answer on May 22, 2026 at 7:16 pm

    First, you should use only bytes objects if you deal with binary data. They require Python 2.6+.

    Example

    data = b"\x42\x43\x44\x45"
    print(data[0:2], data[2:4])
    

    And yes, you can use normal compare operations with bytes.

    I am not sure that kind of object is returned by your readframes but if it is not bytes by design you should convert it to bytes. You can just use data = bytes(obj).

    Do not use strings to process binary data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(code examples are python) Lets assume we have a list of percentages that add
I have a some python code that prints log messages. When run at the
Python's convention is that variables are created by first assignment, and trying to read
I'm having an issue with a rather intricate interaction of C++ and Python that
I've been trying to find a python code that would log in to my
I have an application that receives a pointer to JPEG data from a camera
(When I say object address, I mean the string that you type in Python
I have some python code that binds to a socket. I catch any exception
I am writing a python script that parses a 3D model file from one
I am learning python and django. I need to do extensive stuff for data

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.