Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Clear solution in Clear category for Bit Message by sulogin
from datetime import datetime
def checkio(data):
msg = bytes.fromhex(data)
enc = ['', 'latin1', 'utf-16-be'][msg[0] >> 2 & 3]
bits = int.from_bytes(msg[9:], 'little')
*dt, tz = (i // 16 + i % 16 * 10 for i in msg[1:8])
dt[0] += 2000 if dt[0] < 70 else 1900
return [
'{:%d %b %Y %T} GMT {:+}'.format(datetime(*dt), (tz if tz < 80 else 80 - tz) // 4),
msg[8],
msg[9:].decode(enc) if enc else ''.join(chr(bits >> i * 7 & 127) for i in range(msg[8]))
]
Jan. 6, 2018
Comments: