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

  • Home
  • SEARCH
  • 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 8044333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:11:46+00:00 2026-06-05T05:11:46+00:00

hi i want to hex value to decimal without loop(because ‘speed’ problem) ex) >>>

  • 0

hi i want to hex value to decimal without loop(because ‘speed’ problem)

ex)
>>> myvalue = "\xff\x80\x17\x90\x12\x44\x55\x99\x90\x12\x80"
>>> int(myvalue)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid literal for int() with base 10: '\xff\x80\x17\x90\x12DU\x99\x90\x12\x80'

>>> ord(myvalue)
Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
TypeError: ord() expected a character, but string of length 11 found
>>>

anyone helps ?

  • 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-05T05:11:47+00:00Added an answer on June 5, 2026 at 5:11 am

    Your number seems to be an integer given as binary data. In Python 3.2, you can convert it to a Python integer with int.from_bytes():

    >>> myvalue = b"\xff\x80\x17\x90\x12\x44\x55\x99\x90\x12\x80"
    >>> int.from_bytes(myvalue, "big")
    308880981568086674938794624
    

    The best solution I can come up with for Python 2.x is

    >>> myvalue = "\xff\x80\x17\x90\x12\x44\x55\x99\x90\x12\x80"
    >>> int(myvalue.encode("hex"), 16)
    308880981568086674938794624L
    

    Since this does not involve a Python loop, it should be pretty fast, though.

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

Sidebar

Related Questions

I want to convert a large 64 bit value from decimal or hex string
basically i want to build a colour hex value using 3 decimal values. for
I want to create SolidColorBrush from Hex value such as #ffaacc. How can I
I have an integer and I want to convert it to hex value. I
I want to use HEX number to assign a value to an int: int
I'm trying to store the literal ascii value of hex FFFF which in decimal
I have the following hex value store in a variable: 0x04a8f5 I want to
I have a register ecx with value 0x01ABCDEF (hex value) I want to acces
I want to convert a String value to hex and then back to it's
I want to convert a hex string to a 32 bit signed integer in

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.