Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
- import sys,os,fileinput
- def main(argv):
- for line in fileinput.input():
- bytes = line.lstrip(".byte ").rstrip('\n').split(',')
- print(".byte ", end="")
- for i,byte in enumerate(bytes):
- hexValue = int(byte.lstrip('$'),16)
- hexFormat = "${:02x}"
- print(hexFormat.format((hexValue<<2)&255), end="")
- if i != len(bytes) - 1:
- print(",",end="")
- print("");
- if __name__ == "__main__":
- main(sys.argv[1:])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement