]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/blob - contrib/file/python/example.py
MFC: file 5.22.
[FreeBSD/stable/8.git] / contrib / file / python / example.py
1 #! /usr/bin/python
2
3 import magic
4
5 ms = magic.open(magic.NONE)
6 ms.load()
7 tp = ms.file("/bin/ls")
8 print (tp)
9
10 f = open("/bin/ls", "rb")
11 buf = f.read(4096)
12 f.close()
13
14 tp = ms.buffer(buf)
15 print (tp)
16
17 ms.close()