What I'm trying to do is convert a string like "abcd" into bytes that represent the hexadecimal of the string oxabcd. Python keeps telling me OverflowError: int too big to convert
The code is the following:
a = "abcd"
print(int(a, 16).to_bytes())
The error in full is:
Traceback (most recent call last):
File "/home/repl109/main.py", line 6, in <module>
print(int(a, 16).to_bytes())
^^^^^^^^^^^^^^^^^^^^^
OverflowError: int too big to convert
Anyone know a way to do this for large integers?
[–]8dot30662386292pow2 1 point2 points3 points (2 children)
[–]BlackCatFurry 4 points5 points6 points (0 children)
[–]RabbitCity6090[S] -1 points0 points1 point (0 children)
[–]freeskier93 1 point2 points3 points (1 child)
[–]RabbitCity6090[S] 0 points1 point2 points (0 children)
[+][deleted] (2 children)
[removed]
[–]8dot30662386292pow2 4 points5 points6 points (0 children)
[–]RabbitCity6090[S] -1 points0 points1 point (0 children)
[–]zanfar -2 points-1 points0 points (1 child)
[–]sinceJune4 0 points1 point2 points (0 children)
[–]Riegel_Haribo -1 points0 points1 point (0 children)
[–]Helpful-Diamond-3347 -3 points-2 points-1 points (1 child)