Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,895 questions

51,826 answers

573 users

How to convert bytes to hex in Python

3 Answers

0 votes
hex = 'питон - python'.encode('utf-8')

print(hex)



'''
run:

b'\xd0\xbf\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd - python'

'''

 



answered Apr 9, 2021 by avibootz
0 votes
hex = b'\xab\xcd\xef'.hex()

print(hex)



'''
run:

abcdef

'''

 



answered Apr 9, 2021 by avibootz
0 votes
import binascii
 
b = 'питон - python'.encode('utf-8') 
 
hex = binascii.hexlify(b).decode('utf-8')
  
print(hex)
  
  
  
'''
run:
  
d0bfd0b8d182d0bed0bd202d20707974686f6e
  
'''

 



answered Apr 9, 2021 by avibootz

Related questions

1 answer 91 views
2 answers 164 views
164 views asked Apr 9, 2021 by avibootz
1 answer 116 views
1 answer 140 views
140 views asked Apr 25, 2021 by avibootz
3 answers 225 views
225 views asked Apr 9, 2021 by avibootz
1 answer 139 views
139 views asked Apr 9, 2021 by avibootz
...