Created
March 13, 2020 15:07
-
-
Save tinchoabbate/23557831971e4f53219383d0f06df71a to your computer and use it in GitHub Desktop.
Useful to pass a sequence of bytes to a function argument in Remix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import sys | |
if len(sys.argv) != 2 or len(sys.argv[1]) % 2 != 0: | |
print('Input missing or does not have even number of chars') | |
exit(1) | |
data = sys.argv[1] | |
data = data.replace('0x','') | |
final_string = '' | |
for i,k in zip(data[0::2],data[1::2]): | |
final_string += f'"0x{i}{k}",' | |
print(f'[{final_string[:-1]}]') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment