minix/external/bsd/file/dist/python/example.py

18 lines
207 B
Python
Raw Permalink Normal View History

2012-05-02 13:23:57 +02:00
#! /usr/bin/python
2012-03-31 20:24:03 +02:00
import magic
2012-05-02 13:23:57 +02:00
ms = magic.open(magic.NONE)
2012-03-31 20:24:03 +02:00
ms.load()
2012-05-02 13:23:57 +02:00
tp = ms.file("/bin/ls")
print (tp)
2012-03-31 20:24:03 +02:00
2012-05-02 13:23:57 +02:00
f = open("/bin/ls", "rb")
buf = f.read(4096)
2012-03-31 20:24:03 +02:00
f.close()
2012-05-02 13:23:57 +02:00
tp = ms.buffer(buf)
print (tp)
2012-03-31 20:24:03 +02:00
ms.close()