Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bitwise ~ Operator
#11
I am using a byte as an example because in some languages, a small int = 1 byte. 0-255

I don't understand how your example relates to my problem?

(Feb-05-2021, 06:16 PM)deanhystad Wrote: What makes you think you are using a byte? I don't think Python has a byte type.

It has "bytes", but there are no bytes in bytes.
>>> x = (5).to_bytes(1, 'big')
>>> x
b'\x05'
>>> type(x)
<class 'bytes'>
>>> x[0]
5
>>> type(x[0])
<class 'int'>
bytes is a list of ints
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Program demonstrates operations of bitwise operators without using bitwise operations ShawnYang 2 2,550 Aug-18-2021, 03:06 PM
Last Post: deanhystad
  Bitwise Slicing Peter_Truman 6 5,428 Aug-25-2020, 06:41 AM
Last Post: Peter_Truman
  not bitwise ~15 1885 3 4,180 Oct-30-2019, 03:49 AM
Last Post: 1885
  understanding exponential and bitwise operators srm 1 2,650 Jun-15-2019, 11:14 AM
Last Post: ThomasL

Forum Jump:

User Panel Messages

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