字符串、字节、Hex间的转换

  • hex(int)
1
2
3
4
5
6
7
8
def hex(*args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ 
"""
Return the hexadecimal representation of an integer.

>>> hex(12648430)
'0xc0ffee'
"""
pass
  • B.hex()
1
2
3
4
5
6
7
8
def hex(self): # real signature unknown; restored from __doc__
"""
B.hex() -> string

Create a string of hexadecimal numbers from a bytes object.
Example: b'\xb9\x01\xef'.hex() -> 'b901ef'.
"""
return ""
  • bytes(str)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def __init__(self, value=b'', encoding=None, errors='strict'): # known special case of bytes.__init__
"""
bytes(iterable_of_ints) -> bytes
bytes(string, encoding[, errors]) -> bytes
bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
bytes(int) -> bytes object of size given by the parameter initialized with null bytes
bytes() -> empty bytes object

Construct an immutable array of bytes from:
- an iterable yielding integers in range(256)
- a text string encoded using the specified encoding
- any object implementing the buffer API.
- an integer
# (copied from class doc)
"""
pass
  • bytes.fromhex()
1
2
3
4
5
6
7
8
def fromhex(cls, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ 
"""
Create a bytes object from a string of hexadecimal numbers.

Spaces between two numbers are accepted.
Example: bytes.fromhex('B9 01EF') -> b'\\xb9\\x01\\xef'.
"""
pass

参考:

磁力搜索神器 | 值得收藏的磁力搜索引擎导航,搜索神器在手资源我有!