Last active
July 13, 2020 15:50
-
-
Save alexmagaddino/234e2dddac28dc0f82a128acdb947f83 to your computer and use it in GitHub Desktop.
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
import json | |
from pathlib import Path | |
def normalized(name): | |
return (name.replace("-", "_")).lower() | |
def prettyHex(num): | |
return str(hex(num)).replace("0x","") | |
input = open(Path(__file__).parent / "selection.json") | |
welcome = json.loads(input.read()) | |
ris = "" | |
for icon in welcome["icons"]: | |
code = icon["properties"]["code"] | |
name = icon["properties"]["name"] | |
rr = '"' + prettyHex(code) + '" -> R.drawable.' + normalized(name) + "\n" | |
ris += rr | |
print(ris) | |
output = open(Path('Desktop') / "export.txt", "w") | |
output.write(ris) | |
print("Output write in export.txt") | |
input.close() | |
output.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment