import utmp

if __name__ == '__main__':
    with open('./wtmp(sg)', 'rb') as fd:
        buf = fd.read()
        for entry in utmp.read(buf):
            print(entry.time, entry.type, entry)
반응형