Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from base64 import b64encode
- def from_hex_to_base64(s):
- # convert hex to string (bytes like object)
- plain_text_bytes = bytes.fromhex(s)
- # convert from string to (bytes like object)
- base64_bytes = b64encode(plain_text_bytes)
- # convet from base64 (bytes like object) to base64 (string)
- base64_str = str(base64_bytes, "utf-8")
- # result
- return base64_str
- if __name__ == "__main__":
- s = input()
- res = from_hex_to_base64(s)
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement