Skip to content

Instantly share code, notes, and snippets.



Last active Mar 17, 2020
What would you like to do?
Helper for converting an IOTA address to a C++ hex array
# Imports the textrwap library
from textwrap import wrap
# Replace with your own IOTA payment address
# Create a list with 4 characters in each element
mylist = wrap(sample,4)
result = ''
# Convert each element in the list to hex separated by ,
for i in mylist:
result=result + '0x' + i.encode("utf-8").hex() + ','
# Remove last , from string
# Append the curly brackets
result = '{' + result + '}'
# Print the resulting string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.